Skip to content

Commit db8d4b5

Browse files
FEAT: 1 byte for "true" & "false"
- In C language, - the size of "true" and "false" macro is 4 bytes (for x64 arch) - but the size of "bool" (typedef _Bool) is 1 byte. - In order to decrease the memory usage, we can set the size of "true" and "false" macros to 1 byte using explicit typecasting in macro definition.
1 parent a10f6c1 commit db8d4b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Headers/stdbool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
*/
2323
#elif !defined(__cplusplus)
2424
#define bool _Bool
25-
#define true 1
26-
#define false 0
25+
#define true ((bool)1)
26+
#define false ((bool)0)
2727
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
2828
/* Define _Bool as a GNU extension. */
2929
#define _Bool bool

0 commit comments

Comments
 (0)