C-libs 0.1.0
Some C utils libraries
 
Loading...
Searching...
No Matches
example_assert.c
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;
}
Header file for assertions.
#define COMPILE_ASSERT(predicate, file)
Asserts a compile-time condition.
Definition assert.h:50
#define ASSERT(predicate, fmt,...)
Asserts a runtime condition with a formatted message.
Definition assert.h:76