From: "MuRaT KaRaDeNiZ" <[EMAIL PROTECTED]>
So
U08 RX485_oldbyte1; is uninitialized data, but compiler also initialize
it to zero, why is it different from inline initialization during
declaration, I expect the compiler just replace the zero with the
initial value i provide?
Because reality is different than what you expect.
In C, there are really two kinds of declarations, those that define the
object, and those that reference it. Rule number 1: There may be only 1
defining declaration in a program.
How do you tell the difference? If a declaration includes an initializer,
it is a (the) defining declaration.
If none of the declarations of an object include an initializer, then all
referencing declarations must be declared with the extern storage class.
A top-level declaration without extern and without an initializer is called
a tentative definition. It is treated as a referencing declaration, but if
no other declaration of the variable in the file includes an initializer,
then the tentative definition becomes a defining declaration.
If an implementation permits tentative declarations in multiple translation
units without issuing a diagnostic, it is non-conforming, but supports a
common extension. Avoid taking advantage of this extensionif you want your
code to be portable.
HTH,
-=Dave
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list