From mboxrd@z Thu Jan 1 00:00:00 1970 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <13426df10706051736q4e1852a9g3f54d8f6e2d182b4@mail.gmail.com> References: <13426df10706051736q4e1852a9g3f54d8f6e2d182b4@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <2F03E7E9-C7F5-41C6-9E27-462B6B07EE14@telus.net> Content-Transfer-Encoding: 7bit From: Paul Lalonde Subject: Re: [9fans] quiz Date: Tue, 5 Jun 2007 18:07:00 -0700 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> Topicbox-Message-UUID: 7990df2c-ead2-11e9-9d60-3106f5b1d025 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Signed bit field overflow. You (don't) want "unsigned int botch:1;" Yuck. On 5-Jun-07, at 5:36 PM, ron minnich wrote: > /* catch the bug */ > > struct x { > int botch:1; > }; > > fun(){ > struct x x; > x.botch = 0; > x.botch = 1; > } > > ok, what's the bug? anyone? I just found this out today. (no, I don't > use bitfields, but insane people do) > > ron -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iD8DBQFGZgi1pJeHo/Fbu1wRAk8AAJ9GjwNz6JLxWav33huG68SjB4R1YACfZHNI BtIRBQPaXw91oj5Am+VDVaU= =Ai0G -----END PGP SIGNATURE-----