My Kernel v0.1.0

This file contains macros designed to be used with the compiler. More...

Collaboration diagram for Compiler:

Macros

#define static_assert(cond, ...)    _Static_assert(cond, stringify(cond) __VA_OPT__(": ") __VA_ARGS__)
 Compile-time assertion.
 
#define NON_ZERO(_x)   (1 + sizeof(struct { char size[(_x)-1]; }))
 Raises a compile time eror if _x is 0. More...
 
#define is_native_word(_x)    (sizeof(_x) == 1 || sizeof(_x) == 2 || sizeof(_x) == 4)
 Check whether an expression's result's size is that of a native word.
 
#define same_type(_a, _b)   __builtin_types_compatible_p(typeof(_a), typeof(_b))
 Check whether 2 expresions evaluate to the same type. More...
 

Detailed Description

These includes: compile-time checks, type attributes, ...

Macro Definition Documentation

◆ NON_ZERO

#define NON_ZERO (   _x)    (1 + sizeof(struct { char size[(_x)-1]; }))
Returns
_x so that it can be used as a compile time known value

◆ same_type

#define same_type (   _a,
  _b 
)    __builtin_types_compatible_p(typeof(_a), typeof(_b))

Note that 'unsigned int' and 'int' return false in this case.