[clang] FEAT: one byte for "true" & "false" (PR #138649)
SAKSHAM JOSHI via cfe-commits
cfe-commits at lists.llvm.org
Tue May 6 02:05:00 PDT 2025
https://github.com/saksham-joshi updated https://github.com/llvm/llvm-project/pull/138649
>From 8bba07d817d4dd583122d7ed831de276da8801e0 Mon Sep 17 00:00:00 2001
From: SAKSHAM JOSHI <social.sakshamjoshi at gmail.com>
Date: Tue, 6 May 2025 12:43:34 +0530
Subject: [PATCH] FEAT: one byte for "true" & "false"
In C programming language,
The size of "true" and "false" macros is 4 byte and size of "_Bool" datatype is 1 byte.
By this simple change, we can set the size of "true" and "false" to 1 byte.
---
clang/lib/Headers/stdbool.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/lib/Headers/stdbool.h b/clang/lib/Headers/stdbool.h
index dfaad2b65a9b5..e9142327f0ffd 100644
--- a/clang/lib/Headers/stdbool.h
+++ b/clang/lib/Headers/stdbool.h
@@ -22,8 +22,8 @@
*/
#elif !defined(__cplusplus)
#define bool _Bool
-#define true 1
-#define false 0
+#define true (bool)1
+#define false (bool)0
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Define _Bool as a GNU extension. */
#define _Bool bool
More information about the cfe-commits
mailing list