Re: Large writable variables

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Large writable variables
Дата
Msg-id 2a909e88-ff6a-14e0-517b-eb974cd30005@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Large writable variables  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: Large writable variables
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Large writable variables
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Large writable variables