Hi all,
I'm a printf-like function lover. I always found that better than doing
something like out << "blabla : " << var1 << ", blabla" << etc.
Now, I use a lot of different platforms and to be portable, I'm supposed
to use PRIxxx constants for portability. For me that half-breaks the
readability of printf format.
What about a new set of functions that'll be specified slightly
differently :
What if we can write %d for ANY number ? The compiler can modify the
format litteral at compile time to fit what's needed for that platform,
replacing %d by %hhd, %hd, %d, %ld, %lld, %hhu etc. depending of the arg
passed.
Replacing the litteral format at compile time prevents to modify the
vararg mechanism.
Of course, if format is not litteral : no replacement !
OR
2bis) some attributes could be passed on to these new function so it'll
know what to expect at runtime. I'm guessing modifying vararg mechanism
to add attributes might be nearly impossible... or having to different
vararg mechanism, one legacy and a new one with attributes, seems to
complicate things a lot...
I'm interested of what would you all think about that ?
Thanks.
PS : we could do the same with %s that could accept char*, wchar_t*,
char16_t*, char32_t*.