delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/01/08/03:55:31

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Message-ID: <3FFCF1F4.B86AC9DA@yahoo.com>
Date: Thu, 08 Jan 2004 01:00:20 -0500
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: stdbool.h and complex.h
References: <Pine DOT OSF DOT 4 DOT 58 DOT 0401071356580 DOT 26260 AT sirppi DOT helsinki DOT fi>
Reply-To: djgpp-workers AT delorie DOT com

Esa A E Peuha wrote:
> 
> I have written the headers stdbool.h and complex.h that C99 requires.
> stdbool.h doesn't define any functions and is independent of any
> choice in compiler (in other words, whatever way gcc chooses to
> support Boolean type, it can't affect the contents of stdbool.h),
> so it could be checked in at any time:
> 
> #ifndef __dj_stdbool__h_
> #define __dj_stdbool__h_
> 
> #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
>   || !defined(__STRICT_ANSI__)
> 
> #define bool _Bool
> #define true 1
> #define false 0
> #define __bool_true_false_are_defined 1
> 
> #endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */
> 
> #endif /* !__dj_stdbool__h_ */

I question whether it is necessary to have the __STDC_VERSION etc.
guard, or even desirable.  I see no reason why a c90 user should
not provide a stdbool.h system file and expect it to be used.  As
you point out, those contents are pretty universal, although a C90
version would not be able to use _Bool.  And a C99 user may well
want to use bool etc. without insisting on strict Ansi.

I am not convinced either way myself.  Just raising the question.
My inclination would be to omit the ANSI portion of it.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019