pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org, Thomas Munro <thomas.munro@enterprisedb.com>
Subject: Re: Large writable variables
Date: Thu, 18 Oct 2018 22:20:29 +0200
Message-ID: <2a909e88-ff6a-14e0-517b-eb974cd30005@2ndquadrant.com> (raw)
In-Reply-To: <08adbe4e-38f8-2c73-55f0-591392371687@2ndquadrant.com>
References: <20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de>
	<20181016045051.wr35ubb6h7h3ee2b@alap3.anarazel.de>
	<20181016050200.c65yjz2qgxulgouv@alap3.anarazel.de>
	<20181016063013.kigj6e5pqx6n75y3@alap3.anarazel.de>
	<200cf391-4a60-4c69-85d8-c715c7bce4de@2ndquadrant.com>
	<20181017200200.t752esxtgnefktu3@alap3.anarazel.de>
	<e0c988b9-9df8-51f2-b963-94e27816c622@2ndquadrant.com>
	<20181017215106.esosgw7qfnfavcdw@alap3.anarazel.de>
	<08adbe4e-38f8-2c73-55f0-591392371687@2ndquadrant.com>

On 18/10/2018 22:17, Peter Eisentraut wrote:
> 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.

> Attached is my previous patch adapted to your macro.

Oh, I forgot to mention, your version doesn't work for this code in
pqexpbuffer.c:

    str->data = (char *) oom_buffer;

That's probably not a big deal though.

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




view thread (51+ messages)  latest in thread

Message-ID: <2a909e88-ff6a-14e0-517b-eb974cd30005@2ndquadrant.com>
Permalink:  ../2a909e88-ff6a-14e0-517b-eb974cd30005@2ndquadrant.com/
Also on:    postgresql.org/message-id/2a909e88-ff6a-14e0-517b-eb974cd30005@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, andres@anarazel.de, thomas.munro@enterprisedb.com
  Subject: Re: Large writable variables
  In-Reply-To: <2a909e88-ff6a-14e0-517b-eb974cd30005@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox