-
Notifications
You must be signed in to change notification settings - Fork 657
Description
Many demo examples make an assumption that they can use symbols coming from a different file, due to indirect header inclusion.
For example, Nuklear/demo/common/overview.c uses libm math symbols, but never includes <math.h> or any similar header:
Nuklear/demo/common/overview.c
Lines 1 to 3 in fcd64f8
| #include <limits.h> /* INT_MAX */ | |
| #include <time.h> /* struct tm, localtime */ | |
Nuklear/demo/common/overview.c
Lines 754 to 759 in fcd64f8
| for (id = 0, i = 0; i < 32; ++i) { | |
| nk_chart_push_slot(ctx, (float)fabs(sin(id)), 0); | |
| nk_chart_push_slot(ctx, (float)cos(id), 1); | |
| nk_chart_push_slot(ctx, (float)sin(id), 2); | |
| id += step; | |
| } |
This breaks, if I try to provide my own NK_SIN/NK_COS/STBTT_sqrt/etc in one of the demo files, and then remove the math header there.
This has happened to me when working on updated sdl3_renderer. In newer version of SDL3, <SDL3/SDL.h> does not pull <math.h> any more, and provides its own version of math symbols.
Note that Nuklear/demo/common/overview.c and <math.h> is just an example here. More demos are affected by this issue due to all kinds of headers.