Re: confusing typedefs in jsonfuncs.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: confusing typedefs in jsonfuncs.c
Date: 2013-07-19 01:34:44
Message-ID: 555.1374197684@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> The new jsonfuncs.c has some confusing typedef scheme. For example, it
> has a bunch of definitions like this:

> typedef struct getState
> {
> ...
> } getState, *GetState;

> So GetState is a pointer to getState. I have never seen that kind of
> convention before.

Yeah, this is randomly different from everywhere else in PG. The more
usual convention if you want typedefs for both the struct and the
pointer type is that the pointer type is FooBar and the struct type is
FooBarData. This way seems seriously typo-prone.

> I think a more typical PostgreSQL code convention is to use capitalized
> camelcase for structs, and use explicit pointers for pointers. I have
> attached a patch that cleans this up, in my opinion.

That way is fine with me too.

If you commit this, please hit 9.3 as well, so that we don't have
back-patching issues.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-07-19 01:45:29 Re: Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)
Previous Message Peter Eisentraut 2013-07-19 01:20:16 confusing typedefs in jsonfuncs.c