_Bool may be an intrinsic type
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2371 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
49d1ebf6ab
commit
7692347cfa
@ -51,9 +51,14 @@
|
||||
|
||||
/* bool, true, and false must be provided as macros so that they can be
|
||||
* redefined by the application if necessary.
|
||||
*
|
||||
* NOTE: Under C99 'bool' is required to be defined to be the intrinsic type
|
||||
* _Bool. However, in this NuttX context, we need backward compatibility
|
||||
* to pre-C99 standards where _Bool is not an intrinsic type. Hence, we
|
||||
* use _Bool8 as the underlying type.
|
||||
*/
|
||||
|
||||
#define bool _Bool
|
||||
#define bool _Bool8
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
@ -64,10 +69,17 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* A byte is the smallest address memory element (at least in architectures
|
||||
* that do not support bit banding. We select uint8_t versus the more standard
|
||||
* int as the underlying type to minimize the RAM footprint of the executable.
|
||||
* that do not support bit banding). The requirement is only that type _Bool
|
||||
* be large enough to hold the values 0 and 1. We select uint8_t to minimize
|
||||
* the RAM footprint of the executable.
|
||||
*
|
||||
* NOTE: We can't actually define the type _Bool here. Under C99 _Bool is
|
||||
* an intrinsic type and cannot be the target of a typedef. However, in this
|
||||
* NuttX context, we also need backward compatibility to pre-C99 standards
|
||||
* where _Bool is not an intrinsic type. We work around this by using _Bool8
|
||||
* as the underlying type.
|
||||
*/
|
||||
|
||||
typedef uint8_t _Bool;
|
||||
typedef uint8_t _Bool8;
|
||||
|
||||
#endif /* __INCLUDE_STDBOOL_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user