Skip to content

standard boolean c#174

Open
terryc321 wants to merge 1 commit into
russellallen:masterfrom
terryc321:master
Open

standard boolean c#174
terryc321 wants to merge 1 commit into
russellallen:masterfrom
terryc321:master

Conversation

@terryc321
Copy link
Copy Markdown

use standard boolean c library allows compilation to complete otherwise gcc clang complain and stop with error

[ 96%] Building C object tools/CMakeFiles/cmprev.dir/src/cmprev.c.o self/tools/src/cmprev.c:16:16: error: cannot use keyword ‘false’ as enumeration constant
16 | typedef enum { false, true } bool;
| ^~~~~
self/self/tools/src/cmprev.c:16:16: note: ‘false’ is a keyword with ‘-std=c23’ onwards
self/self/tools/src/cmprev.c:16:30: error: expected ‘;’, identifier or ‘(’ before ‘bool’
16 | typedef enum { false, true } bool;
| ^~~~

use standard boolean c library allows compilation to complete
otherwise gcc clang complain and stop with error

[ 96%] Building C object tools/CMakeFiles/cmprev.dir/src/cmprev.c.o
self/tools/src/cmprev.c:16:16: error: cannot use keyword ‘false’ as enumeration constant
   16 | typedef enum { false, true } bool;
      |                ^~~~~
self/self/tools/src/cmprev.c:16:16: note: ‘false’ is a keyword with ‘-std=c23’ onwards
self/self/tools/src/cmprev.c:16:30: error: expected ‘;’, identifier or ‘(’ before ‘bool’
   16 | typedef enum { false, true } bool;
      |                              ^~~~
@nbuwe
Copy link
Copy Markdown
Contributor

nbuwe commented Jan 7, 2026

Just use CC='cc -std=gnu99' or something (ditto for CXX) to compile on your system. Self sources can still be compiled on quite old systems (e.g. macosx/powerpc with gcc 4.0). Your system compiler might have switched to C23 by default, but that doesn't mean you have to use that default to compile Self.

Note also, that non-vintage clang (13+, iirc) miscompiles Self and cannot be used.

@nbuwe
Copy link
Copy Markdown
Contributor

nbuwe commented Jan 31, 2026

FWIW, I've just compiled with gcc 15 on native i386 using:

export CC='cc -std=gnu99 -no-pie -fno-pie'
export CXX='c++ -std=c++03 -no-pie -fno-pie'

(PIE is tangential to the point).

C++ needs std tuned down b/c of more strict checks for std::nullptr_t conversions in the xlib glue code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants