Re: Add some const decorations to prototypes

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Add some const decorations to prototypes
Date: 2017-11-10 15:17:52
Message-ID: alpine.DEB.2.20.1711101612370.668@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


>> ISTM That there is still at least one strange cast:
>>
>> +static const char **LWLockTrancheArray = NULL;
>> + LWLockTrancheArray = (const char **) // twice
>
> These are not cases of "cheating". This is just the return value of a
> memory allocation function being cast from void * to the appropriate
> result type. That is an orthogonal style decision that I have
> maintained in these cases.

Ok. I'm at the limit of my C abilities.

Your answer is about void * vs char *, I'm okay with that.

My question was about no const / const in the same operation.

Would it make sense that the function returns "const void *", i.e. the
cast is not on the const part but on the pointer type part?

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-11-10 15:29:50 Re: Add some const decorations to prototypes
Previous Message Mark Dilger 2017-11-10 15:17:15 Re: PATCH: multivariate histograms and MCV lists