Dimitrie O. Paun wrote:
On December 26, 2002 12:14 am, Dan Kegel wrote:
Example use: TRACE("Combo client " _RECT_FMT ", setting Edit to " _RECT_FMT "\n", _RECT_ARG(rect), x, y, x + w, y + h);
Oh no! It's not too pretty, isn't it? :)
No, it's pretty ugly :-)
Although this doesn't hide things as well as the inline function, it might have some advantage in size and runtime, since it does more of its work at compile time.
I'll bet you a dollar in small change you can not measure a 1% speed difference. This code executes in trace mode only, where you don't care about the speed anyhow. Also, the since difference must be minute anyhow since the macro approach actually enlarges the strings where it's used.
I thought everyone always left NO_TRACE_MSGS undefined, so the rect2a function you favor gets called unconditionally, and its output filtered out. The macro doesn't enlarge the strings over current practice; it merely codifies existing usage. There would be no net change in string size or code size with the macro approach.
Alternately, we could skip the macros, and just standardize the format strings. Would that be more acceptable?
- Dan