public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* c++, gcc3.2.2 and bitwise operations
@ 2003-02-19  1:36 Chris Croswhite
  2003-02-19 11:56 ` Sebastian Huber
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chris Croswhite @ 2003-02-19  1:36 UTC (permalink / raw)
  To: gcc-help

How can I play with the guts of a variable one bit at a time in c++?  That
is, I want to do something like this,

long long val =0x4000000000000001;
((int*)(&val)[1]) &= 0x0;

(this should set the first bit to zero).  This worked with gcc 2.95.x, but I
understand now that the casting (&val)[1] (to an array) is "undefined" and
therefore not predictible.

Could anyone give me hand?

TIA,
Chris


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-19 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19  1:36 c++, gcc3.2.2 and bitwise operations Chris Croswhite
2003-02-19 11:56 ` Sebastian Huber
2003-02-19 12:25 ` Nathan Sidwell
2003-02-19 13:08 ` John Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).