Re: [HACKERS] VacAttrStatsP vs VacAttrStats * (typedef'ing pointer types)

2008-05-02 Thread Neil Conway
On Fri, 2008-05-02 at 23:22 +0200, Jan UrbaƄski wrote:
 While looking around vacuum.h (for my GSoC project) I found:
 typedef struct VacAttrStats *VacAttrStatsP;
 and then throughout the code sometimes VacAttrStats *foo is used and 
 sometimes VacAttrStatsP bar is used.

Personally I think we should be consistent about this and just use one
form for a given type.

(I don't really care which variant is preferred. Personally, I think
that hiding pointer types inside a typedef is evil and wrong, but it is
relatively common practice in the source...)

-Neil



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] VacAttrStatsP vs VacAttrStats * (typedef'ing pointer types)

2008-05-02 Thread Tom Lane
=?UTF-8?B?SmFuIFVyYmHFhHNraQ==?= [EMAIL PROTECTED] writes:
 While looking around vacuum.h (for my GSoC project) I found:
 typedef struct VacAttrStats *VacAttrStatsP;
 and then throughout the code sometimes VacAttrStats *foo is used and 
 sometimes VacAttrStatsP bar is used.

 Call this obsessive-compulsive disorder, but it kind of bothers me. Is 
 there a reason for using both notations? If not, then which one is 
 preferred and should I write a patch for it or should I just take a pill 
 or two and focus on important things?

Hmm.  We have a fairly widespread convention that pointers to structs
can be separately typedef'd as Foo where the underlying struct is
typedef FooData.  This isn't following that naming convention though,
and right offhand FooP doesn't seem an improvement over Foo *.

I also notice that there are many more uses of VacAttrStats * than
VacAttrStatsP, so the collective vote about which notation is clearer
seems already taken.

If it bugs you, I'd suggest getting rid of typedef VacAttrStatsP
altogether and using VacAttrStats * everywhere.  It's surely not
too important though...

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers