Re: unconstify equivalent for volatile - Mailing list pgsql-hackers

From Andres Freund
Subject Re: unconstify equivalent for volatile
Date
Msg-id 20190218163200.slspmu3b7n45sskf@alap3.anarazel.de
Whole thread Raw
In response to Re: unconstify equivalent for volatile  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

On 2019-02-18 10:43:50 -0500, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> > I propose to add an equivalent to unconstify() for volatile.  When
> > working on this, I picked the name unvolatize() mostly as a joke, but it
> > appears it's a real word.  Other ideas?
> 
> Umm ... wouldn't this amount to papering over actual bugs?  I can
> think of legitimate reasons to cast away const, but casting away
> volatile seems pretty dangerous, and not something to encourage
> by making it notationally easy.

Most of those seem to be cases where volatile was just to make sigsetjmp
safe. There's plently legitimate cases where we need to cast volatile
away in those, e.g. because the variable needs to be passed to memcpy.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Use varargs macro for CACHEDEBUG
Next
From: Andres Freund
Date:
Subject: Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line