From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
Subject: | Re: Large writable variables |
Date: | 2018-10-18 20:17:55 |
Message-ID: | 08adbe4e-38f8-2c73-55f0-591392371687@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 | Content-Type | Size |
---|---|---|
v2-0001-Apply-unconstify-in-more-places.patch | text/plain | 3.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2018-10-18 20:20:29 | Re: Large writable variables |
Previous Message | Peter Eisentraut | 2018-10-18 19:57:00 | removing unnecessary get_att*() lsyscache functions |