Skip to content

Commit

Permalink
Add _Bool type
Browse files Browse the repository at this point in the history
As requested in oriansj/M2libc#67.

The standard (C17) says in 6.2.5.2:
```text
An object declared as type _Bool is large enough to store the values 0 and 1
```

It could technically be an int but all major compilers have `sizeof(bool) == 1`.
  • Loading branch information
gtker committed Jan 17, 2025
1 parent 5f22f14 commit 59a381a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 219 deletions.
4 changes: 4 additions & 0 deletions cc_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ void initialize_types(void)
hold = new_primitive("char", "char*", "char**", 1, TRUE);
prim_types = add_primitive(hold);

/* Define _Bool */
hold = new_primitive("_Bool", "_Bool*", "_Bool**", 1, TRUE);
prim_types = add_primitive(hold);

/* Define FUNCTION */
hold = new_primitive("FUNCTION", "FUNCTION*", "FUNCTION**", register_size, FALSE);
prim_types = add_primitive(hold);
Expand Down
Loading

0 comments on commit 59a381a

Please sign in to comment.