2 ms·
There are a number of reasons: - Support for weird compilers - Focus on performance, thus playing "weird" tricks with macros, lookup tables etc. - especially
by johannes1234321 6y ago
There are a number of reasons:
- Support for weird compilers
- Focus on performance, thus playing "weird" tricks with macros, lookup tables etc.
- especially in headers: protect against users doing crazy sh*t
- standards sometimes change or see extensions
- certainly more :)
First two items can be re-evaluated form time to time, but especially GNU often aims to run "anywhere"
The third item comes from the fact that users can create macros for many things and only some names (leading _ and capital letter or __) are reserved for standards or C++ allowing to overload the comma operator, which can have weird effects. Thus to be conformant to the standards some ugliness is required.
The fourth point combined with different compatibility requirements requires tricks to switch between different implementations based on compiler flags/macros (for instance `#define _GNU_SOURCE` or `#define _POSIX_C_SOURCE=...`)