Subject: Re: Compiler warnings

From: Dominik Vogt <[email-masked]>
Date: Wed, 30 Jun 1999 03:47:44 +0200

On Tue, Jun 29, 1999 at 02:32:10PM -0400, Paul D. Smith wrote:
> While helping someone compile FVWM on SGI recently they were using the
> bundled SGI C compiler, and they got _tons_ of warnings because of the
> way we define bitfields in FVWM.  I've also heard of these types of
> warnings with HP's C compiler.
> 
> Basically, we use this in many places:
> 
>   Bool  isThis:1;
> 
> The problem here is that Bool (an X type) is defined to be int, which is
> a signed integer.  So there could [*] be a bit reserved for signedness.
> But, we have only one bit.  Thus warnings.  Most compilers with DTRT
> here, even as they spit out tons of warnings (it's a quality of
> implementation issue :) but still it'd be nice to avoid them in the
> first place.
> 
> Similarly, if we use something like:
> 
>   int   numItems:2;
> 
> we really can't be sure whether the valid values for this bitfield are
> the expected 0-4, or {-2, -1, 0, 1}.
> 
> The latter is simple to fix, by using:
> 
>   unsigned int numItems:2;
> 
> The former can only be fixed by punting the X Bool type.  The question
> is, should we just change these to straight "unsigned int" or do people
> feel that creating a "uBool" type would be more appropriate?  I prefer
> just using unsigned int, but I'm not losing sleep over it.

In most other places we use

  unsigned foo:1;

For consistency it's better to always use it anyway. Let's simply make
the change.

Bye

Dominik ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]