Re: [PATCHES] WIP: guc enums

2008-03-05 Thread Magnus Hagander
On Wed, Mar 05, 2008 at 08:18:19AM -0500, Tom Lane wrote: > "Heikki Linnakangas" <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> What I'd suggest is declaring the actual variable as int. You can still > >> use an enum typedef to declare the values, and just avert your eyes > >> when you have

Re: [PATCHES] WIP: guc enums

2008-03-05 Thread Andrew Dunstan
Tom Lane wrote: Having to have two extra hook functions for every variable seems like a lot of notational overhead for not much gain. +1 cheers andrew -- Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org) To make changes to your subscription: http://mail.postgresql.org

Re: [PATCHES] WIP: guc enums

2008-03-05 Thread Tom Lane
"Heikki Linnakangas" <[EMAIL PROTECTED]> writes: > Oh no, I didn't suggest keeping the variables as strings, that's > madness. I suggested keeping the variables as enums, and defining > "setter" functions for them, similar to the assign hooks we have now, > but the setter function wouldn't have

Re: [PATCHES] WIP: guc enums

2008-03-05 Thread Heikki Linnakangas
Tom Lane wrote: "Heikki Linnakangas" <[EMAIL PROTECTED]> writes: Tom Lane wrote: What I'd suggest is declaring the actual variable as int. You can still use an enum typedef to declare the values, and just avert your eyes when you have to cast the enum to int or vice versa. (This is legal per

Re: [PATCHES] WIP: guc enums

2008-03-05 Thread Tom Lane
"Heikki Linnakangas" <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> What I'd suggest is declaring the actual variable as int. You can still >> use an enum typedef to declare the values, and just avert your eyes >> when you have to cast the enum to int or vice versa. (This is legal per >> C spec

Re: [PATCHES] WIP: guc enums

2008-03-05 Thread Magnus Hagander
On Tue, Mar 04, 2008 at 09:35:27PM +, Heikki Linnakangas wrote: > > We could keep using the assignment hooks. But they could be a lot > simpler than they are nowadays, if the string -> int conversion was done > by the GUC machinery: > > static const char * > assign_client_min_messages(int n

Re: [PATCHES] WIP: guc enums

2008-03-05 Thread Heikki Linnakangas
Tom Lane wrote: "Heikki Linnakangas" <[EMAIL PROTECTED]> writes: Magnus Hagander wrote: On my platform (linux x86) it works fine when I just cast this to (int *), but I'm unsure if that's going to be safe on other platforms. I had some indication that it's probably not? No, I don't think that

Re: [PATCHES] WIP: guc enums

2008-03-04 Thread Tom Lane
"Heikki Linnakangas" <[EMAIL PROTECTED]> writes: > Magnus Hagander wrote: >> On my platform (linux x86) it works fine when I just cast this to (int *), >> but I'm unsure if that's going to be safe on other platforms. I had some >> indication that it's probably not? > No, I don't think that's safe.

Re: [PATCHES] WIP: guc enums

2008-03-04 Thread Heikki Linnakangas
Magnus Hagander wrote: The patch only converts a couple of the potential enum variables to the new type, mainly as a proof of concept. But already I hit the problem twice - the variable that holds the value of the guc enum is a C enum itself, which gives a compiler warning when I pass a pointer t