FreeEMS  0.2.0-SNAPSHOT-285-g028e24c
Macros | Functions
typeChecks.h File Reference

Compile time checks on types. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#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];


 CASSERT ((sizeof(Clock)%2)==0, Clock) CASSERT((sizeof(Counter)%2)
Counter CASSERT ((sizeof(CoreVar)%2)==0, CoreVar) CASSERT((sizeof(DerivedVar)%2)

Detailed Description

Compile time checks on types.

This file contains checks on sizes of various structs.

Definition in file typeChecks.h.

Macro Definition Documentation

#define CASSERT (   predicate,
)    _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.

predicateThe predicate to test. It must evaluate to something that can be coerced to a normal C boolean.
fileA 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,
)    a##b

Definition at line 69 of file typeChecks.h.

#define _impl_CASSERT_LINE (   predicate,
)    typedef char _impl_PASTE(assertion_failed_##file##_,line)[2*!!(predicate)-1];

Definition at line 70 of file typeChecks.h.

Function Documentation

CASSERT ( (sizeof(Clock)%2)  = = 0,
Counter CASSERT ( (sizeof(CoreVar)%2)  = = 0,