This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Help with bit-field semantics in C and C++
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Mike Stump <mrs at apple dot com>
- Cc: Joe Buck <Joe dot Buck at synopsys dot COM>, Roger Sayle <roger at eyesopen dot com>, Mark Mitchell <mark at codesourcery dot com>, gcc at gcc dot gnu dot org
- Date: 25 Aug 2004 01:02:41 +0200
- Subject: Re: Help with bit-field semantics in C and C++
- Organization: Integrable Solutions
- References: <3417ECB8-F61F-11D8-AF5A-003065BDF310@apple.com>
Mike Stump <mrs@apple.com> writes:
[...]
| which if you squint, you can see it more closely matches my example...
|
| > | e = 7;
|
| Ok, I blew that one... I was thinking of a slightly different test
| case. One that made full use of the full range of the underlying type
| in a portable program.
As repeatedly demonstrated, only use of the bit-sized full range is
covered. Not the whole underlying integer type.
| T<sizeof (e)> x = 7;
| memcpy ((char *)&e, (char *)&x, sizeof (e));
|
| The issue remains the same... Could be good DR material...
|
| > Values of type bool are either true or false.42)
|
| Yeah, and I was thinking of:
|
| 42) Using a bool value in ways described by this International Stan-
| dard as ``undefined,'' such as by examining the value of an uninitial-
| ized automatic variable, might cause it to behave as if is neither
| true nor false.
That is a (non-normative) note to remind that a trap representation is
still permitted for bools, not a note that would contractid the very
rule (of which this footnote is appended) that any value of bool type
is either false or true.