エラー番号
提供: cppreference.com
<errno.h> で定義されている各マクロは一意な正の整数値を持つ int 型の整数定数式に展開されます。 以下の定数が ISO C によって定義されます。 'E' で始まり、数字または大文字が続く限りにおいて、処理形は追加の定数を定義しても構いません。
ヘッダ
<errno.h> で定義 | |
EDOM |
関数の数学引数が定義域外です (マクロ定数) |
EILSEQ (C95) |
バイトシーケンスが不正です (マクロ定数) |
ERANGE |
結果が大きすぎます (マクロ定数) |
ノート
多くの追加のエラー定数が POSIX および C++ 標準ライブラリによって定義されています。 個々の処理系がさらに追加の定数を定義するかもしれません。 Linux の errno(3)、 BSD や OS X の intro(2) も参照してください。
例
Run this code
#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <string.h>
int main(void)
{
errno = 0;
printf("log(-1.0) = %f\n", log(-1.0));
printf("%s\n\n",strerror(errno));
errno = 0;
printf("log(0.0) = %f\n", log(0.0));
printf("%s\n",strerror(errno));
}
出力例:
log(-1.0) = nan
Numerical argument out of domain
log(0.0) = -inf
Numerical result out of range
参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.5/2 Errors <errno.h> (p: 205)