GCC 12 Adds Support For New #elifdef #elifndef Directives
With C2X and potentially a future version of C++, there is finally the #elifdef and #elifndef directives. The GNU Compiler Collection is preparing its support.
There has long been #ifdef, #else, #elif and similar directives for controlling conditional compilation in C/C++. While there has been #ifdef, until the upcoming C2X there hasn't been #elifdef for else if defined or #elifndef for else if not defined... Short of pairing "#elif defined()" or so. With C2X the #elifdef and #elifndef pre-processor directives are finally there and it's being looked at for C++ as well.
There is this blog post for those interested in that it was actually some what of a battle earlier this year getting the feature accepted during the last C meeting.
Merged yesterday to GCC 12 was the initial work on #elifdef and #elifndef. For the time being the directives are supported with just the c2x/gnu2x language targeting while waiting to see if/when they will be accepted for C++.
LLVM Clang also has pending patches for supporting these convenient directives as well.
There has long been #ifdef, #else, #elif and similar directives for controlling conditional compilation in C/C++. While there has been #ifdef, until the upcoming C2X there hasn't been #elifdef for else if defined or #elifndef for else if not defined... Short of pairing "#elif defined()" or so. With C2X the #elifdef and #elifndef pre-processor directives are finally there and it's being looked at for C++ as well.
There is this blog post for those interested in that it was actually some what of a battle earlier this year getting the feature accepted during the last C meeting.
Merged yesterday to GCC 12 was the initial work on #elifdef and #elifndef. For the time being the directives are supported with just the c2x/gnu2x language targeting while waiting to see if/when they will be accepted for C++.
LLVM Clang also has pending patches for supporting these convenient directives as well.
28 Comments