プログラミング言語C/C++のそれぞれ次期バージョンC2x(C23)/C++2b(C++23)では、新しいプリプロセッサディレクティブ#elifdef
と#elifndef
が追加される予定。*1
#ifdef identifier
:#if defined(identifier)
と等価#ifndef identifier
:#if !defined(identifier)
と等価#elifdef identifier
:#elif defined(identifier)
と等価#elifndef identifier
:#elif !defined(identifier)
と等価
おまけ:本提案に対する反応の一つ。
"if I had a time machine, I’d blow
No Us Without You - elifdef and elifndef | The Pasture#ifdef
up and just make people used#if defined(...)
, it’s better and more flexible and represents the same functionality";
関連URL
- JTC1/SC22/WG14 (PDF)N2645 Add support for preprocessing directives #elifdef and #elifndef
- JTC1/SC22/WG21 (PDF)P2334R1 Add support for preprocessing directives elifdef and elifndef
- No Us Without You - elifdef and elifndef | The Pasture
- https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=71d38ec80008afdbb9a059253407d80598b765c0
- https://reviews.llvm.org/D101192