Talk:Struct (C programming language): Difference between revisions

Content deleted Content added
Type punning: Answer an interesting possiblity for the article
Declare/define: new section
Line 32:
Salient internals for our lead section are the '''size''' (as mentioned), and the method of '''chaining''' the members of a C struct to one another.
&mdash; [[User:Cpiral|<font color="#00000">Cp</font><font color="#80C000">i</font><font color="#C08000">r</font><font color="#C00000">al</font>]][[User talk:Cpiral|<font color="#2820F0"><u>Cpiral</u></font>]] 21:31, 1 October 2011 (UTC)
 
== Declare/define ==
 
"The memory is already given and zeroed by just declaring a variable of that type regardless of member initialization" is nonsense. Declarations do not allocate memory. Object definitions allocate memory. Furthermore, that memory is not "zeroed" by a definition (let alone a declaration!). It is necessary to initialize at least one member of the struct if one wishes the default static initializer rule to cut in. If the initializer is another struct, a bitwise copy is made, and thus any members (note: members, not fields!) that were 0 in the initializing struct will be 0 in the initialized struct.
 
I didn't bother correcting the article, because it's a waste of time. There always seems to be someone ready and waiting to uncorrect it again.
 
[[User:BinaryDigit|BinaryDigit]] ([[User talk:BinaryDigit|talk]]) 17:00, 14 March 2012 (UTC)