Re: Syntax for partitioning - Mailing list pgsql-hackers

From Nikhil Sontakke
Subject Re: Syntax for partitioning
Date
Msg-id a301bfd90911192144g41ce4a2do50cfefe75a47615f@mail.gmail.com
Whole thread Raw
In response to Re: Syntax for partitioning  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Syntax for partitioning
Re: Syntax for partitioning
List pgsql-hackers
Hi,

>> > partinfo = (PartitionInfo *) malloc(ntups * sizeof(PartitionInfo));
>
> 1) Please stop casting the results of palloc and malloc.  We are not
> writing C++ here.
>

I thought it was/is a good C programming practice to typecast (void *)
always to the returning structure type!!

Regards,
Nikhils

> 2) I would prefer that you apply sizeof on the variable, not on the
> type.  That way, the expression is independent of any type changes of
> the variable, and can be reviewed without having to scroll around for
> the variable definition.
>
> So how about,
>
> partinfo = palloc(ntups * sizeof(*partinfo));
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>



--
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: operator exclusion constraints
Next
From: Tom Lane
Date:
Subject: Re: Union test case broken in make check?