This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with bit-field semantics in C and C++


David Carlton <david.carlton@sun.com> writes:

[...]

| Having said that, after I sent my last message, I noticed the
| following (footnote 42 to 3.9.1p6):
| 
|   Using a bool value in ways described by this International Standard
|   as "undefined," such as by examining the value of an uninitialized
|   automatic variable, might cause it to behave as if [it] is neither
|   true nor false.

This footnote essentially is an instantiation of a general principle:
uninitialized variable, of type other than character, might trap.
That is what the footnote is saying.  If you have an actual bool
value, it ought to be either true or false.  However, if you accessed
an uninitialized bool object or use a bool object in situation
undefined (by the standard), then you might get surprises -- e.g. 
"rm -rf ~/". 

That is no inconsitent with other view you expressed.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]