エラー指令
提供: cppreference.com
< c | preprocessor
指定されたエラーメッセージを表示し、プログラムを ill-formed にします。
構文
#error error_message
|
|||||||||
説明
#error 指令に遭遇した後、処理系は診断メッセージ error_message を表示し、プログラムを ill-formed にします (コンパイルを停止します)。
error_message は複数の単語から構成することができます。 引用符で囲む必要はありません。
例
Run this code
#if __STDC__ != 1
# error "Not a standard compliant compiler"
#endif
#include <stdio.h>
int main (void)
{
printf("The compiler used conforms to the ISO C Standard !!");
}
出力例:
The compiler used conforms to the ISO C Standard !!
参考文献
- C11 standard (ISO/IEC 9899:2011):
- 6.10.5 Error directive (p: 174)
- C99 standard (ISO/IEC 9899:1999):
- 6.10.5 Error directive (p: 159)
- C89/C90 standard (ISO/IEC 9899:1990):
- 3.8.5 Error directive
関連項目
エラー指令 の C++リファレンス
|