Thursday, November 11, 2021

[SOLVED] Earliest support of __alignof__ in GCC

Issue

I need a portable way to determine alignment requirements of a structure, where portability includes legacy versions of GCC. Parts of project are stuck with embedded platforms supporting pre-C++11 standard only, as early as GCC v.3.6.

There is a non-ISO __alignof__ (a macro? a function?) analog of C++11 operator alignof which I can use, but what is the earliest version of GCC compiler would support it? Were there alternatives or changes in naming?


Solution

The oldest version of GCC with documentation available online at gcc.gnu.org is 2.95.3. That version does support __alignof__ extension.



Answered By - eerorika