Skip to content

Commit

Permalink
mytharchive: fix use of reserved keywords for C23
Browse files Browse the repository at this point in the history
Testing with Fedora rawhide, builds fail with:

    error: cannot use keyword 'false' as enumeration constant
    typedef enum { false = 0, true = 1 }    bool;
                   ^~~~~
    note: 'false' is a keyword with '-std=c23' onwards
    error: expected ';', identifier or '(' before 'bool'
    typedef enum { false = 0, true = 1 }    bool;
                                            ^~~~
  • Loading branch information
Bill Meek committed Feb 28, 2025
1 parent 1bc1742 commit bc4476e
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#
*/

#if __STDC_VERSION__ < 202311L // C23
typedef enum { false = 0, true = 1 } bool;
#endif
typedef unsigned char bool8;


Expand Down

1 comment on commit bc4476e

@garybuhrmaster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this could not have been accomplished by adding a #include <stdbool.h> (which has its own version tests) and removing the local definition of bool entirely. Completely untested.

Please sign in to comment.