Re: stdbool.h vs SupportDefs.h

"Axel Dörfler" <[email protected]>
Newsgroups gmane.os.openbeos.kernel.devel
Message-ID <19696721308-BeMail@zon>
Hi Jérôme,

Jérome DUVAL <[email protected]> wrote:
> i have a conflict between stdbool.h and SupportDefs.h so i'm willing 
> to 
> use this for stdbool.h and do an #include <stdbool.h> in 
> SupportDefs.h :

I even ran into this as well some time ago and had an updated stdbool.h 
locally, but I accidently deleted it while removing my old CVS copy of 
the sources.

> #ifndef _STDBOOL_H_
> #define _STDBOOL_H_
> /*
> ** Distributed under the terms of the Haiku License.
> */

How about using something like this:
/*
 * Copyright 2005, Haiku Inc. All Rights Reserved.
 * Distributed under the terms of the MIT License.
 */
#ifndef _STDBOOL_H_
...
?

> #ifndef __cplusplus
> typedef enum { false = 0, true = 1 } _Bool;
> #define true 1
> #define false 0
> #else
> typedef bool _Bool;
> #define true true
> #define false false
> #endif
> #define bool _Bool
> 
> #define __bool_true_false_are_defined 1
> 
> #endif  /* _STDBOOL_H_ */

Looks better than it does now :)

> in SupportDefs.h these lines would be removed :
> 
> #ifndef __cplusplus
> typedef enum { false = 0, true = 1 } _Bool;
> #define       bool    _Bool
> #define false 0
> #define true  1
> #endif

But then we should probably include stdbool.h, too, right?

> some comments :
> * I know that a stdbool.h is defined by GCC, so we could theorically 
> remove this stdbool.h

I think we should keep it for now. IMO, platform and compiler 
independent headers like these should be placed in our repository 
anyway.

> * headers/os/drivers/device_manager.h isn't including a stdbool.h, 
> there is a 
> warning about incompatibility with gcc definitions obviously

Would this still happen when SupportDefs.h includes stdbool.h? Anyway, 
feel free to fix it :)

Bye,
   Axel.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.