Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitfields and Crafty

Author: Bruce Moreland

Date: 01:25:35 07/17/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?
>
>Tord

It's not so bad as this.  If you use MSVC, it assumes signed chars.  That's a
lot of people who are doing signed chars.  If another compiler is going to
default chars to unsigned, they will add a compiler switch that lets you default
them to signed.

MSVC has a -J switch that defaults them to unsigned.

If you have a "lot" of code that depends upon this, you are probably doing math
on chars too much.  It's not a good idea to do serious math on scalar types
other than int and unsigned.

bruce



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.