Re: Discontent with development process (was:Re: pgaccess - the discussion is over)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)tm(dot)ee>
Cc: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, mlw <markw(at)mohawksoft(dot)com>, Iavor Raytchev <iavor(dot)raytchev(at)verysmall(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Discontent with development process (was:Re: pgaccess - the discussion is over)
Date: 2002-05-14 13:52:47
Message-ID: 25563.1021384367@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

Hannu Krosing <hannu(at)tm(dot)ee> writes:
> What would your opinion be of some hack with macros, like

> #if (Win32 or THREADED)
> #define GLOBAL_ pg_globals.
> #else
> #define GLOBAL_
> #endif

> and then use global variables as

> GLOBAL_globvar

> At least in my opinion that would increase both readability and
> maintainability.

From a code readability viewpoint this is not at all better than just
moving everything to pg_globals. You're only spelling "pg_globals."
a little differently. And it introduces twin possibilities for error:
omitting GLOBAL_ (if you're a Unix developer) or writing
pg_globals. explicitly (if you're a Win32 guy). I suppose these errors
would be caught as soon as someone tried to compile on the other
platform, but it still seems like a mess with little redeeming value.

I think there had been some talk of

#if Win32
#define myvar pg_globals.f_myvar
#else
static int myvar;
#endif

which seems a more effective use of macros --- it would at least allow
the code to be written without explicit awareness of the special status
of the variable. Still seems like a maintenance nightmare though.

The real problem with airily saying "we'll just move that variable to
pg_globals" is that it falls down the instant that you consider
non-scalar variables. What if it's a pointer to a palloc'd structure?
Sure we can get around this, but not transparently.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2002-05-14 14:17:31 Re: Discontent with development process (was:Re: pgaccess
Previous Message Hannu Krosing 2002-05-14 13:40:38 Re: [HACKERS] Bug #659: lower()/upper() bug on

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jan Wieck 2002-05-14 14:17:31 Re: Discontent with development process (was:Re: pgaccess
Previous Message Tom Knowles 2002-05-14 08:42:34 Lost info on unsubscribe