C-libs
0.1.0
Some C utils libraries
Loading...
Searching...
No Matches
example_assert.c
#include <
ayaztub/utils/assert.h
>
int
main(
void
) {
COMPILE_ASSERT
(
sizeof
(
size_t
) == 8, main_example);
ASSERT
(1 == 1,
"%s"
,
"assert correct"
);
ASSERT
(1 == 0,
"%s"
,
"assert should fail"
);
// The following example failed to compile !
// COMPILE_ASSERT(sizeof(char) == sizeof(long), static_assert_fail_example);
return
0;
}
assert.h
Header file for assertions.
COMPILE_ASSERT
#define COMPILE_ASSERT(predicate, file)
Asserts a compile-time condition.
Definition
assert.h:50
ASSERT
#define ASSERT(predicate, fmt,...)
Asserts a runtime condition with a formatted message.
Definition
assert.h:76
Generated by
1.13.2