Re: Unit testing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Unit testing
Date
Msg-id 26160.1097542267@sss.pgh.pa.us
Whole thread Raw
In response to Re: Unit testing  (Neil Conway <neilc@samurai.com>)
Responses Re: Unit testing
List pgsql-hackers
Neil Conway <neilc@samurai.com> writes:
> On Tue, 2004-10-12 at 00:43, Tom Lane wrote:
>> Most likely (and I for one will for sure resist any attempt to force
>> global uniqueness on static names).

> You're right that the issue can be avoided easily enough, but what need
> is there _not_ to have globally unique function names?

To me that's pretty much in the you've-got-to-be-kidding domain.  The
reason static functions and local name scoping were invented was exactly
to avoid having to ensure every single name is unique across a whole
project.  The overhead of avoiding duplicates swamps any possible
benefit.

There is another problem with it, which is static variables.  While the
linker should warn about duplicate global code symbols, it's quite
likely to think duplicate global variable declarations should be merged,
thereby silently changing the semantics (and introducing hard-to-find
bugs).  Not to mention the extent of semantics change invoidfoo f(){static int i = 0;...}
So you'd have to be very very careful about just which occurrences of
"static" you removed.  I don't think I'd trust a "column 1" heuristic.

The real bottom line here is that the entire objective of the exercise
is to find bugs ... and we don't really expect it to find a lot of them,
just a few more than our existing methods find.  So adding even a small
probability of introducing new bugs may do serious damage to the
cost/benefit ratio.  Thus I'm pretty skeptical of any part of the
proposal that says to make nontrivial alterations to the existing code.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: Unit testing
Next
From: Gavin Sherry
Date:
Subject: Re: Unit testing