|
From: | Richard Henderson |
Subject: | Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation |
Date: | Fri, 7 May 2021 09:22:13 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |