Re: [HACKERS] Add some const decorations to prototypes

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] Add some const decorations to prototypes
Дата
Msg-id 256a6ce5-25a3-a296-9c0c-cd63953e83e7@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Add some const decorations to prototypes  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
On 11/10/17 11:42, Fabien COELHO wrote:
> After your explanation, and on third thoughts, ISTM that the assignment 
> should not include "const" in the explicit cast, i.e., use
> 
>    extern void * msg_func(void);
>    const char * msg = (char *) msg_func();
> 
> The variable or field is constant, not what the function returns, so
> 
>    const char * msg = (const char *) msg_func();
> 
> does not really make full sense to me, and moreover the compiler does not 
> complain without the const.

The compiler knows how to handle the char * -> const char * case, but
not the char ** -> const char ** case.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Fix bloom WAL tap test
Следующее
От: Graham Leggett
Дата:
Сообщение: [HACKERS] [Patch] Log SSL certificate verification errors