is this declaration correct

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,567
Members
47,203
Latest member
EmmaSwank1

Latest Threads

Top