From Waclaw.Marcin.Kusnierczyk at idi.ntnu.no  Sun Feb 22 22:38:01 2009
From: Waclaw.Marcin.Kusnierczyk at idi.ntnu.no (Wacek Kusnierczyk)
Date: Sun, 22 Feb 2009 22:38:01 +0100
Subject: [Rd] 'unique' error message is
	printed	despite	silent=TRUE	(PR#13547)
In-Reply-To: <49A1C13F.5090109@stats.uwo.ca>
References: <20090222191519.17912282C76C@mail.pubhealth.ku.dk>	<49A1B292.1070908@biostat.ku.dk>
	<49A1BEB5.6050701@idi.ntnu.no> <49A1C13F.5090109@stats.uwo.ca>
Message-ID: <49A1C5B9.9050905@idi.ntnu.no>

Duncan Murdoch wrote:
>
>>
>> hmm, why wouldn't you use something like
>>
>>     DEBUG(x)
>>
>> with DEBUG being a macro defined so that it's replacement is void unless
>> a specific flag or environment variable is set specifically for the
>> purpose of debugging?  you would then avoid confusing users' code just
>> because one PrintValue has been inadvertently left in the sources.
>
> But then we'd confuse developers, who would see a huge dump of messages
> from every other debugging session, when they just wanted to see their
> own, and who would be forced to wade through leftover never-used
> DEBUG(x) calls in code when they were reading the source.
>

my point was not that such DEBUG statements should be left there in the
code for all eternity.  to the contrary, their role would be quite the
same as that of the PrintValue discussed here.  it would, however, be
easier to switch between printing and not printing such debugging
messages, and also easier to spot DEBUG statements inadvertently left in
the code. 

> This is not a common error:  as far as I know, there are no other
> unintentional PrintValue calls anywhere in the source.  So I think the
> current system (just take them out before committing) is working.

grep --include=*.c -R '\bPrintValue\b' src | wc -l

reports 21 occurrences of PrintValue, though of course i cannot say
anything about their being intentional or not unless i examine the
sources.  if they were DEBUGs, you'd know for sure they're not supposed
to stay there in a release version.

it's just to wish that those who introduce debugging PrintValues
examined diffs carefully before their code is released.  given the size
of r sources (and their fairly ad hoc shape here and there), few others
than the author will know for sure whether the PrintValue is a debugger
or not?  apparently, no one has noticed in this case.  were it DEBUG
instead of PrintValue, it would suffice to run a grep to catch it.

vQ



[Rd] 'unique' error message is printed despite silent=TRUE (PR#13547)
Wacek Kusnierczyk