Does Initialization Entail Lvalue-to-Rvalue Conversion?
The C 11 Standard remains ambiguous on whether initialization requires lvalue-to-rvalue conversion. However, evidence suggests that rvalues are expected as operands in built-in operators, unless specified otherwise. This approach has been extended to the context of initializers.
Conjecture: Prvalues Expected for Values
The assumed specification is that prvalues are expected wherever a value is needed, including during initialization. This implies that an lvalue-to-rvalue conversion is required when initializing an object.
Consequences of the Conjecture
If initialization expects prvalues, the following occur:
Further Evidence
Additional evidence supporting this conjecture includes:
Conclusion
Based on the provided evidence, the most likely interpretation is that initialization expects prvalues, resulting in undefined behavior when using uninitialized lvalues as initializers. This interpretation aligns with the broader approach of expecting rvalues in built-in operators unless specified otherwise.
The above is the detailed content of Does C Initialization Require Lvalue-to-Rvalue Conversion?. For more information, please follow other related articles on the PHP Chinese website!