OT: Requesting C advice

Andy Green andy at warmcat.com
Thu May 31 11:14:28 UTC 2007


Mike McCarty wrote:
> Andy Green wrote:
>> Mike McCarty wrote:
> 
> [snip]
> 
>>> C doesn't initialize what? It initializes all used variables.
>>
>>
>> Not if they're on the stack.  You should get a compiler warning
>> nowadays... but don't count on it!
> 
> Erm, C knows nothing about a "stack". However, it is true
> that automatic variable are not necessarily initialized.
> I should have stated that all statically allocated variables
> are initialized. Thanks for the correction.

You're welcome.

I think you have to draw a line between the glorious worlds of
possibility left open by the wording of the standard and the grimy
reality of the actual compilers.  "Automatic variables" will be
allocated off the stack frame on any actual compiler that is worth the name.

Though back in the day I did read about a C "compiler" for a tragic arch
that neither had a stack nor more than 256 bytes of RAM IIRC... it
disallowed recursion or more than 2 function call depth...  other than
that I propose any compiler will be using a stack frame whether the word
is in the standard or not ;-)

-Andy




More information about the users mailing list