Do curly brackets always imply a stack frame. Example 1:
{
int b;
}
Obviously a stack frame will be created. So then example 2:
<some code>
{
int a;
<some more code>
}
<yet more code>
I'd assume there will be a stack frame to reflect the scope of a
.
Example 3:
for (i=0; i<10; i++)
{
<single statement of code>
}
Is a stack frame created for the scope of i
?
Example 4:
And is it more efficient code-wise to use:
for (i=0; i<10; i++)
<single statement of code>
In generally, my question is does the compiler always create a stack frame when curly braces are used, or does it use intelligence and only create them when required?
[If my knowledge of stack frames seems a bit simplistic, I'm going back 30 years to my degrees, so apologies for that]