Re: Large writable variables - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Large writable variables
Date
Msg-id 08adbe4e-38f8-2c73-55f0-591392371687@2ndquadrant.com
Whole thread Raw
In response to Re: Large writable variables  (Andres Freund <andres@anarazel.de>)
Responses Re: Large writable variables  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Re: Large writable variables  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 17/10/2018 23:51, Andres Freund wrote:
>> __builtin_types_compatible_p(const char *, char *) returns false (0) for me.
> 
> Right, that's why I added a const, inside the macro,  to the type
> specified in the unconstify argument. So typeof() yields a const char *,
> and the return type is specified as char *, and adding a const in the
> argument also yields a const char *.

Yeah, that works.  The C++-inspired version also allowed casting from
not-const to const, which we don't really need.

I'd perhaps change the signature

#define unconstify(underlying_type, var)

because the "var" doesn't actually have to be a variable.

Attached is my previous patch adapted to your macro.

I'm tempted to get rid of the stuff in dfmgr.c and just let the "older
platforms" get the warning.

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

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: removing unnecessary get_att*() lsyscache functions
Next
From: Peter Eisentraut
Date:
Subject: Re: Large writable variables