Proposal: Type safe (printf) TC logging.

Currently TC log functions work with (unsafe) va_list format arguments.

Since C++11 its possible to add variadic template arguments so its possible to implement type safe printf functions now that are even faster then cstdio’s [COLOR=rgb(153,0,0)]sprintf because of perfect forwarding (r-value references) and metaprogramming.

The main benefit is that it will warn about wrong formatters (“%s” instead of “%d” for example).

You can find some background information and implementations here:

Not backward compatible to sprintf:

There is also a boost implementation of format but didn’t take a look at it yet.

Backward compatible to sprintf:

I’m sure that it will take less effort to replace va_args &sprintf by a backward compatible typesafe version of format.

What do you think about it?

I’m all for it as long as it is not required to change all the calls to TC_LOG_X.

No see this… all hacks and va_args are removed but the [COLOR=rgb(40,40,40)]TC_LOG_X macros are untouched.