On Wed, 2023-09-27 at 22:33 +0200, Страхиња Радић wrote: > On closer inspection, termbox2.h does include signal.h itself[1], and > additionally defines _XOPEN_SOURCE[2] and _DEFAULT_SOURCE, so the > inclusion of > signal.h can't be escaped. > > My testing has shown that when -std=c99 is specified, it is as if > that switch > explicitly undefines _DEFAULT_SOURCE/_XOPEN_SOURCE **defined inside > the header > file** (this is the weird part). If -D_DEFAULT_SOURCE is given as an > argument,
This, I've been played several times with -std and _POSIX_C_SOURCE/_XOPEN_SOURCE and experienced many different behavior depending on the system and libc. Example, I remember that setting _XOPEN_SOURCE could hide non-standard functions which can still be useful as long as you take care of the proper #define. Not sure if that helps but I eventually stopped adding flags at all and use just the defaults everywhere. Otherwise I'd be glad to understand if there is a complete and strict conformance explanation on those combinations. -- David