Re: [HACKERS] Add some const decorations to prototypes - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: [HACKERS] Add some const decorations to prototypes
Date
Msg-id alpine.DEB.2.20.1711101612370.668@lancre
Whole thread Raw
In response to Re: [HACKERS] Add some const decorations to prototypes  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: [HACKERS] Add some const decorations to prototypes  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: [HACKERS] Add some const decorations to prototypes  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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.


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

pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Next
From: Fabien COELHO
Date:
Subject: Re: [HACKERS] Add some const decorations to prototypes