From:
Gregory Stark <stark(at)enterprisedb(dot)com>
To:
"Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc:
"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "David Fetter" <david(at)fetter(dot)org>
Subject:
Re: Macros for typtype (was Re: Arrays of Complex Types)
Date:
2007-04-01 09:36:39
Message-ID:
87y7lca120.fsf@oxford.xeocode.com (view raw or flat )
Thread:
2007-03-02 23:40:16 from David Fetter <david(at)fetter(dot)org>
2007-03-02 23:59:50 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-03 00:42:14 from "Andrew Dunstan" <andrew(at)dunslane(dot)net>
2007-03-03 13:14:57 from Martijn van Oosterhout <kleptog(at)svana(dot)org>
2007-03-03 14:06:11 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-03-03 17:25:23 from David Fetter <david(at)fetter(dot)org>
2007-03-03 17:45:32 from Gregory Stark <stark(at)enterprisedb(dot)com>
2007-03-04 00:48:38 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-03-06 21:05:56 from David Fetter <david(at)fetter(dot)org>
2007-03-06 21:14:07 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-06 21:17:41 from David Fetter <david(at)fetter(dot)org>
2007-03-06 21:24:36 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-06 21:27:12 from David Fetter <david(at)fetter(dot)org>
2007-03-26 01:31:58 from David Fetter <david(at)fetter(dot)org>
2007-03-26 02:18:14 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-27 18:08:44 from David Fetter <david(at)fetter(dot)org>
2007-03-27 19:39:04 from David Fetter <david(at)fetter(dot)org>
2007-03-27 21:04:39 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-03-28 07:05:24 from Andrew - Supernews <andrew+nonews(at)supernews(dot)com>
2007-03-28 16:57:38 from David Fetter <david(at)fetter(dot)org>
2007-03-28 17:11:05 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2007-03-28 17:33:56 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-03-28 18:48:57 from David Fetter <david(at)fetter(dot)org>
2007-03-28 17:35:54 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-28 19:15:20 from Gregory Stark <stark(at)enterprisedb(dot)com>
2007-03-28 19:24:26 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-28 19:41:07 from David Fetter <david(at)fetter(dot)org>
2007-03-30 20:23:58 from David Fetter <david(at)fetter(dot)org>
2007-03-30 21:08:42 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-31 23:10:08 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-03-31 23:13:20 from Bruce Momjian <bruce(at)momjian(dot)us>
2007-03-31 23:36:21 from David Fetter <david(at)fetter(dot)org>
2007-03-31 23:58:34 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-01 00:22:18 from David Fetter <david(at)fetter(dot)org>
2007-04-01 00:28:54 from Peter Eisentraut <peter_e(at)gmx(dot)net>
2007-04-01 02:31:26 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-01 07:40:09 from Peter Eisentraut <peter_e(at)gmx(dot)net>
2007-04-01 07:50:07 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-01 08:15:29 from Peter Eisentraut <peter_e(at)gmx(dot)net>
2007-04-01 09:36:39 from Gregory Stark <stark(at)enterprisedb(dot)com>
2007-04-01 10:04:06 from Peter Eisentraut <peter_e(at)gmx(dot)net>
2007-04-01 18:31:41 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-01 20:18:57 from Peter Eisentraut <peter_e(at)gmx(dot)net>
2007-04-02 04:11:08 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-02 20:10:05 from David Fetter <david(at)fetter(dot)org>
2007-04-03 00:28:15 from Bruce Momjian <bruce(at)momjian(dot)us>
2007-04-03 02:01:44 from Alvaro Herrera <alvherre(at)commandprompt(dot)com>
2007-04-03 06:10:13 from David Fetter <david(at)fetter(dot)org>
2007-04-03 06:30:07 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-03 13:29:23 from David Fetter <david(at)fetter(dot)org>
2007-04-03 14:20:44 from Bruce Momjian <bruce(at)momjian(dot)us>
2007-04-08 22:47:44 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-04-08 23:08:38 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-08 23:32:22 from David Fetter <david(at)fetter(dot)org>
2007-04-08 23:36:17 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-04-09 00:09:59 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-09 00:35:53 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-04-09 00:41:06 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-09 01:53:46 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-04-09 02:24:23 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-09 14:14:41 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-04-09 14:40:49 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-04-09 16:39:36 from David Fetter <david(at)fetter(dot)org>
2007-04-09 19:57:34 from Martijn van Oosterhout <kleptog(at)svana(dot)org>
2007-04-09 20:07:16 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-04-09 21:12:24 from Martijn van Oosterhout <kleptog(at)svana(dot)org>
2007-05-06 17:33:47 from Andrew Dunstan <andrew(at)dunslane(dot)net>
2007-05-06 17:47:32 from David Fetter <david(at)fetter(dot)org>
2007-05-11 18:27:49 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
2007-05-11 20:19:51 from "Merlin Moncure" <mmoncure(at)gmail(dot)com>
Lists:
pgsql-hackers pgsql-patches
"Peter Eisentraut" <peter_e(at)gmx(dot)net> writes:
> Tom Lane wrote:
>> What bothers me about that is I don't think the C spec mandates the
>> representation width. If we could guarantee that enum typtype_type
>> was 1 byte I'd be all for it.
>
> The width is 4 both for the macro and the enum case. Both
>
> #define TYPTYPE_BASE 'b'
>
> and
>
> enum ... {
> TYPTYPE_BASE = 'b',
>
> effectively generate int constants named TYPTYPE_BASE with decimal value
> 98. So there are no storage advantages either way.
That's not accurate at all. The macro case gives you a constant you can only
use to initialize integer variables and members that are explicitly declared
with some integral type. If we consistently declare them "char" then they'll
be predictably 1 byte long.
The enum case does two things. It defines a syntactic meaning for the label,
*and* it defines a thing "enum typtype" which can be used to define variables
and members. If the latter is used then Tom is saying the standard doesn't
specify what width the variable or member will be.
We could use enum {} to define the labels and then make a rule that all actual
variables should be declared using "char" rather than declaring them as "enum
typtype". But I fear somebody would get that wrong some day. The worst thing
is that it might work on their compiler or it might even work on all compilers
and just silently be causing things to be aligned differently than they
expect.
On the other hand it I don't really think it would cause any problems if
people stored their typtypes in integers. Except for the actual FormData_pg_*
structures the precise alignment doesn't actually matter for anything does it?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
In response to
Responses
pgsql-hackers by date
Next :From: Peter EisentrautDate: 2007-04-01 10:04:06
Subject : Re: Macros for typtype (was Re: Arrays of Complex Types)
Previous :From : Peter EisentrautDate : 2007-04-01 08:15:29
Subject : Re: Macros for typtype (was Re: Arrays of Complex Types)
pgsql-patches by date
Next :From: Peter EisentrautDate: 2007-04-01 10:04:06
Subject : Re: Macros for typtype (was Re: Arrays of Complex Types)
Previous :From : Peter EisentrautDate : 2007-04-01 08:15:29
Subject : Re: Macros for typtype (was Re: Arrays of Complex Types)