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

From Peter Eisentraut
Subject Re: [HACKERS] Add some const decorations to prototypes
Date
Msg-id 256a6ce5-25a3-a296-9c0c-cd63953e83e7@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] Add some const decorations to prototypes  (Fabien COELHO <coelho@cri.ensmp.fr>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Fix bloom WAL tap test
Next
From: Graham Leggett
Date:
Subject: [HACKERS] [Patch] Log SSL certificate verification errors