Re: OT: Requesting C advice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 31 May 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.

For completeness, dynamically allocated memory is not initialized either, unless allocated with calloc() (in which case, it is initialized to zeros) or realloc() (in which case, any added space is not initialized).


Mike


--
		Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux