This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 156fb83007a include/stdbool.h: Define true and false as the integer 
constants 1 and 0.
156fb83007a is described below

commit 156fb83007a724f5d9c8e0fbec08afccbf923a8f
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Oct 8 22:02:17 2026 +0200

    include/stdbool.h: Define true and false as the integer constants 1 and 0.
    
    C99 7.16 requires true and false to expand to the integer constants 1
    and 0, suitable for use in #if.  NuttX defined them as (bool)1 and
    (bool)0, so a preprocessor condition such as "#if !true" did not
    compile.
    
    Define them as 1 and 0.  The values do not change; only their type in
    an expression changes, from bool to int, as the standard requires.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/stdbool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/stdbool.h b/include/stdbool.h
index daabbc69d05..847f20068fd 100644
--- a/include/stdbool.h
+++ b/include/stdbool.h
@@ -76,8 +76,8 @@
 #      define bool uint8_t
 #    endif
 
-#    define true  (bool)1
-#    define false (bool)0
+#    define true  1
+#    define false 0
 
 #    define __bool_true_false_are_defined 1
 #  else

Reply via email to