FreeEMS
0.2.0-SNAPSHOT-282-g9efc524
|
Compile time checks on types. More...
Go to the source code of this file.
Macros | |
#define | CASSERT(predicate, file) _impl_CASSERT_LINE(predicate,__LINE__,file) |
A compile time assertion check. | |
#define | _impl_PASTE(a, b) a##b |
#define | _impl_CASSERT_LINE(predicate, line, file) typedef char _impl_PASTE(assertion_failed_##file##_,line)[2*!!(predicate)-1]; |
Functions | |
CASSERT ((sizeof(Clock)%2)==0, Clock) CASSERT((sizeof(Counter)%2) | |
Counter | CASSERT ((sizeof(CoreVar)%2)==0, CoreVar) CASSERT((sizeof(DerivedVar)%2) |
Compile time checks on types.
This file contains checks on sizes of various structs.
Definition in file typeChecks.h.
#define CASSERT | ( | predicate, | |
file | |||
) | _impl_CASSERT_LINE(predicate,__LINE__,file) |
A compile time assertion check.
Validate at compile time that the predicate is true without generating code. This can be used at any point in a source file where typedef is legal.
On success, compilation proceeds normally.
On failure, attempts to typedef an array type of negative size. The offending line will look like typedef assertion_failed_file_h_42[-1] where file is the content of the second parameter which should typically be related in some obvious way to the containing file name, 42 is the line number in the file on which the assertion appears, and -1 is the result of a calculation based on the predicate failing.
predicate | The predicate to test. It must evaluate to something that can be coerced to a normal C boolean. |
file | A sequence of legal identifier characters that should uniquely identify the source file in which this condition appears. |
Definition at line 68 of file typeChecks.h.
#define _impl_PASTE | ( | a, | |
b | |||
) | a##b |
Definition at line 69 of file typeChecks.h.
#define _impl_CASSERT_LINE | ( | predicate, | |
line, | |||
file | |||
) | typedef char _impl_PASTE(assertion_failed_##file##_,line)[2*!!(predicate)-1]; |
Definition at line 70 of file typeChecks.h.