On 5/5/21 7:15 PM, Keith Busch wrote:
Thank you, that makes sense. In this case, we are talking about an
integer constant expression for the value of a 'const' symbol. That
seems like perfect fodder for a compiler to optimize. I understand it's
not obligated to do that, but I assumed it would.

It probably did compile the code such that there is no variable-sized allocation from the stack. That optimization does not change the *semantics* of the code as written -- the only reason this compiles is via use of a variable length array.


r~


Reply via email to