assert.h: add comments explaining the omission of include guards

This commit is contained in:
Jessica Hamilton 2015-04-17 07:03:40 +12:00
parent e4de39c4e4
commit c7ad68f08c

View File

@ -3,6 +3,22 @@
* Distributed under the terms of the MIT License.
*/
/* Include guards are omitted, as assert.h is required
to support being included multiple times.
E.g. the following is required to be valid:
#undef NDEBUG
#include <assert.h>
assert(0); // this assertion will be triggered
#define NDEBUG
#include <assert.h>
assert(0); // this assertion will not be triggered
*/
#undef assert
#ifndef NDEBUG