OT: Requesting C advice

Mike McCarty Mike.McCarty at sbcglobal.net
Thu May 31 22:04:54 UTC 2007


Les wrote:
> On Thu, 2007-05-31 at 05:52 -0500, 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.
>>
>>Mike
>>-- 
> 
> 
> That must be something recent.  Also some people believed that it did in

IIRC, it was mentioned in K&R v1.

[snip]

>     This part I am sure of, because I have had to fix many, many peoples
> code due to this belief.  The ANSI comittee may have changed the
> standard, but I would bet that a lot of older compilers still generate
> code with no initialization.

Older? ANSI C is since 1989. I guess one could characterize 19 years
as "older". :-)

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!




More information about the fedora-list mailing list