Re: Fix volatile vs. pointer confusion

Поиск
Список
Период
Сортировка
Искать
От
Alvaro Herrera
Тема
Re: Fix volatile vs. pointer confusion
Дата
Msg-id
20190311115739.GA5231@alvherre.pgsql
Ответ на
Список
Дерево обсуждения
Fix volatile vs. pointer confusion Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: Fix volatile vs. pointer confusion Michael Paquier <michael@paquier.xyz>
Re: Fix volatile vs. pointer confusion Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: Fix volatile vs. pointer confusion Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Fix volatile vs. pointer confusion Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: Fix volatile vs. pointer confusion Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
On 2019-Mar-11, Peter Eisentraut wrote:

> Variables used after a longjmp() need to be declared volatile.  In
> case of a pointer, it's the pointer itself that needs to be declared
> volatile, not the pointed-to value.  So we need
> 
>     PyObject *volatile items;
> 
> instead of
> 
>     volatile PyObject *items;  /* wrong */

Looking at recently committed 2e616dee9e60, we have introduced this:

+       volatile xmlBufferPtr buf = NULL;
+       volatile xmlNodePtr cur_copy = NULL;

where the pointer-ness nature of the object is inside the typedef.  I
*suppose* that this is correct as written.  There are a few occurrences
of this pattern in eg. contrib/xml2.


-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

В списке pgsql-hackers по дате отправления
От: Shaoqi Bai
Дата:
От: Peter Eisentraut
Дата:
FAQ