Skip to content

Include stdbool.h in the C API header - #211

Open
Auburn wants to merge 1 commit into
masterfrom
fix/c-api-stdbool
Open

Auburn wants to merge 1 commit into
masterfrom
fix/c-api-stdbool

Conversation

@Auburn

@Auburn Auburn commented Oct 22, 2026

Copy link
Copy Markdown
Owner

FastNoise_C.h uses bool as the return type of fnSetVariableFloat, fnSetVariableIntEnum, fnSetNodeLookup, fnSetHybridNodeLookup and fnSetHybridFloat, but never includes <stdbool.h>. A C file that includes the header fails to compile before C23:

FastNoise/FastNoise_C.h(415,15): error: unknown type name 'bool'

This adds #include <stdbool.h> after Utility/Export.h, inside #ifndef __cplusplus, so C++ consumers are unchanged.

Testing

A small .c file that includes only <FastNoise/FastNoise_C.h> (no stdbool.h of its own), builds a FractalFBm + Simplex tree from metadata, and calls all the bool setters plus fnGenUniformGrid2D / fnGenSingle2D:

  • gcc 13.3 (WSL): -std=c99, c11, c17 and c2x with -Wall -Wextra -pedantic -Werror all compile. Against the master header it fails with the bool errors.
  • clang-cl 19 /TC /W4 /WX: compiles, links against a Release FastNoise.dll and runs; setters return true on valid indices and false on an out-of-range one.
  • FastNoiseCpp11Test and the DLL (which compiles FastNoise_C.cpp as C++) build and run as before.

- FastNoise_C.h returns bool from several setters but never included stdbool.h, so C files before C23 failed with "unknown type name 'bool'"
- Only included for C; C++ consumers are unchanged

This branch has not been deployed

No deployments
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.

1 participant