Re: Unit testing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Unit testing
Date: 2004-10-12 00:51:07
Message-ID: 26160.1097542267@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway <neilc(at)samurai(dot)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 in
void
foo 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gavin Sherry 2004-10-12 00:55:47 Re: Unit testing
Previous Message Neil Conway 2004-10-12 00:39:12 Re: Unit testing