I'm trying to implement my own macro assertion for learning purposes. The problem is I don't manage evaluate an expression at compile time (a compile-time evaluable expression of course) and to write a message at compile time in stdout/stderr. How does <assert.h>
manage to do that?
What I tried so far is a structure like:
#define MY_ASSERT(_EXPR) (\
#IF (_EXPR)
// don't know how to tell preprocess to write a message
#ENDIF \
)
but it is clearly wrong syntactically and maybe conceptually.