I have an integer constant known at compile time (but not at code-writing time) and I would like to generate, also at compile time, a const char*
holding them as ASCII. For example
const int C = IntegerConst;
const char*C_as_text = StaticConvert(A);
such that if IntegerConst
is given in some #include
d header file, say IntegerConst=42
, than C_as_text="42"
.
Any idea how to get such a StaticConvert()
functionality? In principle this must be possible, as the compiler and preprocessor have all the necessary information at hand.