Re: [HACKERS] Add some const decorations to prototypes

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: [HACKERS] Add some const decorations to prototypes
Дата
Msg-id alpine.DEB.2.20.1711101612370.668@lancre
обсуждение исходный текст
Ответ на Re: [HACKERS] Add some const decorations to prototypes  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: [HACKERS] Add some const decorations to prototypes
Re: [HACKERS] Add some const decorations to prototypes
Список 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 по дате отправления:

Предыдущее
От: Mark Dilger
Дата:
Сообщение: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: [HACKERS] Add some const decorations to prototypes