Mail Archives: djgpp-workers/2004/01/08/03:55:31
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 -