T
Tim Rentsch
Phil Carmody said:Why is printf at file scope considered such an undesirable
"contamination" in the case where the #if'ed test code is active?
You've contaminated the library with all the test functions already,
and even with local declarations you still cause the linker to link
your lib file to the stdio implementation library. I can't see why a
file-scope printf symbol would be a straw that breaks any particular
camel's back.
It's one motivation. I'm sure some people would find it sufficiently
compelling, and others not. Personally I like to limit the scope of
"dangerous" access as much as can be done practically; in this case
I don't see any significant downside to restricting the availability
(given the limited number of places where access is needed), so using
local declarations might seem like the right tradeoff. I accept that
other people might decide a different tradeoff is better. I guess
the point I'm trying to make is that there are weights on both sides
of the scale.