This question already has an answer here:
- GCC dump preprocessor defines 5 answers
Is there any way to have the C compiler (XC16 in my case, which is based on gcc) dump the results of compile-time expressions?
We have lots of #defines like
#define FOO 37.6
#define FOO_BASE 0.035
#define FOO_FIXEDPOINT (int16_t)(FOO/FOO_BASE)
and I would like to know the actual numbers that the compiler reduces these expressions to.
Note that this is NOT the same thing as wanting to know what the preprocessor outputs; the preprocessor does not compute math, it only substitutes in things. If I look at the preprocessor output, I get (effectively)
#define FOO_FIXEDPOINT (int16_t)(37.6/0.035)
and it's the compiler, not the preprocessor, which figures out a value.
Aucun commentaire:
Enregistrer un commentaire