Re: Reliance on undefined behaviour in << operator - Mailing list pgsql-hackers

From ktm@rice.edu
Subject Re: Reliance on undefined behaviour in << operator
Date
Msg-id 20150916202923.GP18476@aart.rice.edu
Whole thread Raw
In response to Re: Reliance on undefined behaviour in << operator  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Sep 16, 2015 at 03:57:04PM -0400, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
> > On Wed, Sep 16, 2015 at 3:16 AM, Craig Ringer <craig@2ndquadrant.com> wrote:
> >> Our implementation of << is a direct wrapper around the C operator. It
> >> does not check the right-hand side's value.
> >> ... On x64 intel gcc linux it does a rotation but that's
> >> not AFAIK guaranteed by anything, and we should probably not be
> >> relying on this or exposing it at the user level.
> 
> > I agree.
> 
> As far as I'm concerned, what those operators mean is "whatever your
> compiler makes them mean".  This is hardly the only place where we expose
> platform-dependent behavior --- see also locale dependencies, timezones,
> floating point, yadda yadda --- and I do not find it the most compelling
> place to start reversing that general approach.
> 
>             regards, tom lane
> 
+1

I tend to agree. Unless the behavior is mandated by the SQL standard, I have
always expected the behavior of those apps to follow that defined by the
compiler.

Regards,
Ken



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Building storage/lwlocknames.h?
Next
From: Peter Eisentraut
Date:
Subject: Re: What is the extent of FDW join pushdown support in 9.5?