On 28/07/2023 21:51, Thorsten Glaser via austin-group-l at The Open Group wrote:
Davin McCall via austin-group-l at The Open Group dixit:

Since the operand isn't evaluated, there is no null pointer dereference. It is

That’s what I told them, but they weren’t convinced.

This has been definitively answered in DRs #109 and #132 in the context of division by zero, but the same reasoning applies in full to null pointer dereferences. Even if an expression has operands that would otherwise permit evaluation as a constant expression, if the expression would have undefined behaviour if evaluated, but the expression isn't evaluated, and is not used in a context that requires a constant expression, the implementation must accept it.

https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_109.html
https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_132.html

Cheers,
Harald van Dijk

Reply via email to