Non-Standard GNU C/C++ Features (aka Extensions)

Overview

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).

Initialisation Priorities

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.