Non-Standard GNU C/C++ Features (aka Extensions)
Article by:Geoffrey Hunter
GNU offers some non-standard features in their C and C++ compilers. They call these extensions. I do not recommend using extensions where possible, they are extremely compiler specific and make your code less portable.
That said, they are still sometimes the best tool for the job (e.g. you can’t do something any other way, or the non-compiler specific method is ugly and horrible).
GNU allows you to determine the initialisation order of global static variables by specifying a priority.
Usually, myVar1 would be initialisaed before myVar2. However, with myVar2 being specified with the priority 12 (lower numbers equate to a higher priority), myVar2 will be initialised first.
This work is licensed under a Creative Commons Attribution 4.0 International License .