Skip site navigation (1) Skip section navigation (2)

Re: pg_dump.options.diff

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Serguei Mokhov" <mokhov(at)cs(dot)concordia(dot)ca>
Cc: "Manfred Koizar" <mkoi-pg(at)aon(dot)at>,"PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>,"Peter Eisentraut" <peter_e(at)gmx(dot)net>,"PostgreSQL Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: pg_dump.options.diff
Date: 2003-01-02 23:16:07
Message-ID: 4981.1041549367@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
"Serguei Mokhov" <mokhov(at)cs(dot)concordia(dot)ca> writes:
>> But there's no good place to put it.  I'd say just stick it into each
>> tool; it's no worse than repeating the existence of a "usage()"
>> subroutine in each tool.

> It ended up being in dumputils.h

I really don't like putting a macro with a name as short as "xo" into a
header file, even one of relatively narrow scope.  It's too likely to
create weird conflicts.  My inclination is to make the coding be more
like

static void
usage(void)
{
#if defined(HAVE_GETOPT_LONG)
#define xo(longOption,shortOption,desc)  printf("%s %s\n", longOption, desc)
#else
#define xo(longOption,shortOption,desc)  printf("%s %s\n", shortOption, desc)
#endif

	... lots of xo() calls ...

#undef xo
}

This gives us the convenience of a very short name within the usage()
subroutines, while not polluting the namespace for everyplace else in
these utilities.

As I said before, duplicating the definition of xo() in each file that
uses it doesn't bother me a bit; it's too simple for that to be a
significant objection.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Lamar OwenDate: 2003-01-02 23:18:23
Subject: Upgrading rant.
Previous:From: Peter EisentrautDate: 2003-01-02 23:07:52
Subject: Re: PostgreSQL Password Cracker

pgsql-patches by date

Next:From: Rod TaylorDate: 2003-01-02 23:27:10
Subject: Re: ALTER TABLE .. SET WITH / WITHOUT OIDS
Previous:From: Tom LaneDate: 2003-01-02 23:08:38
Subject: Re: ALTER TABLE .. SET WITH / WITHOUT OIDS

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group