Re: Large writable variables

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
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:29:39
Message-ID: 20181018202939.nrdxlnonnjnwbf3b@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2018-10-18 22:20:29 +0200, Peter Eisentraut wrote:
> 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 kind of seems correct ;). Can easily be done via unconstify(char *,
&oom_buffer[0]), if necessary.

> That's probably not a big deal though.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-10-18 20:31:13 Re: Large writable variables
Previous Message Peter Eisentraut 2018-10-18 20:20:29 Re: Large writable variables