Tom Lane wrote:
>Hannu Krosing <hannu@tm.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.
>
Another suggestion might be to create a global hashtable that stores the
size and pointer
to global structures for each subsection. Each subsection can define
its own globals
structure and register them with the hashtable. This would not impact
readablity and
make the gobal environment easy to copy. IMHO, this is possible with
minimal performance
impact.
Myron Scott
mkscott@sacadia.com