Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitfields and Crafty

Author: Dann Corbit

Date: 12:38:10 07/16/01

Go up one level in this thread


On July 16, 2001 at 14:58:04, Tord Romstad wrote:

>On July 11, 2001 at 23:36:39, Robert Hyatt wrote:
>
>>2.  The ANSI standards committee did the same stupid thing with bit fields that
>>they did with other key issues, "this is left to the vendor's discretion..."
>>Ie is a char signed or unsigned by default?  Depends on the compiler.
>
>Please tell me you are just kidding.  I have always assumed that chars are
>signed by default, and a lot of my code depends on it.  Are you saying that
>my code could stop working when I switch to another compiler?

No.  Unadorned char is either signed or unsigned, depending upon the
implementation.  The reason for strange things like this is preexisting code.
Imagine you have have a collection of hundreds of thousands of lines of code,
and suddenly a restriction is imposed which breaks it.

Personally, I would have gone ahead and broken all of the code.  After all:

int foo;
long bar;

do not leave the signed nature of foo and bar up to chance for whatever compiler
is used, they must be signed.

You can get a copy of the ANSI and ISO standards for $18 in PDF format and it
will prevent you from discovering a lot of headaches later.

You can get a pre-ratified draft of the standard for free.




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.