assert
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <cassert>
|
||
#ifdef NDEBUG #define assert(condition) ((void)0) |
||
マクロ
assert
の定義は、標準ライブラリで定義されていない別のマクロ、NDEBUGに依存.Original:
The definition of the macro
assert
depends on another macro, NDEBUG, which is not defined by the standard library.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
NDEBUGが
<cassert>
が含まれているソース·コード内の時点でマクロ名として定義されている場合、assert
は何もしません.Original:
If NDEBUG is defined as a macro name at the point in the source code where
<cassert>
is included, then assert
does nothing.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
NDEBUGが定義されていない場合、その後
assert
チェックはその引数が(これは、スカラ型でなければなりません)がゼロに等しい場合。その場合は、assert
標準エラー出力に実装固有の診断情報を出力し、std::abort呼び出します。診断情報がexpression
のテキストだけでなく、標準的なマクロ__FILE__、__LINE__、標準変数__func__の値を含むように要求される.Original:
If NDEBUG is not defined, then
assert
checks if its argument (which must have scalar type) compares equal to zero. If it does, assert
outputs implementation-specific diagnostic information on the standard error output and calls std::abort. The diagnostic information is required to include the text of expression
, as well as the values of the standard macros __FILE__, __LINE__, and the standard variable __func__.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] パラメータ
condition | - | スカラー型の式
Original: expression of scalar type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
(なし)
[編集] 例
このコードを実行します
出力:
Execution continues past the first assert test: test.cc:8: int main(): Assertion `2+2==5' failed. Aborted
[編集] 参照
静的なアサーション | (C++11およびそれ以降)をチェックコンパイル時アサーションを実行します
Original: performs compile-time assertion checking (C++11およびそれ以降) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
(清掃なし)プログラムの異常終了が発生します Original: causes abnormal program termination (without cleaning up) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数) |