Re: [BUGS] Inconsistent shift operator

2008-04-20 Thread Sam Mason
On Sun, Apr 20, 2008 at 12:27:38PM -0400, Tom Lane wrote: > Sam Mason <[EMAIL PROTECTED]> writes: > > Wouldn't it be easy to put some code like this in: > > if (arg2 < 16) > > return PG_RETURN_INT16(arg1 << arg2); > > return PG_RETURN_INT16(0); > > This is a straw man. It covers *one* of

Re: [BUGS] Inconsistent shift operator

2008-04-20 Thread Peter Eisentraut
Tom Lane wrote: > And I still find the premise entirely unconvincing. > Maybe the user *wants* to see the local behavior of shift, whatever > it might be.  It's certainly not impossible that we'd break applications > that worked fine before (at least on the hardware they were being > used on). Cer

Re: [BUGS] Inconsistent shift operator

2008-04-20 Thread Tom Lane
Sam Mason <[EMAIL PROTECTED]> writes: > Wouldn't it be easy to put some code like this in: > if (arg2 < 16) > return PG_RETURN_INT16(arg1 << arg2); > return PG_RETURN_INT16(0); This is a straw man. It covers *one* of the behaviors left undefined by the C standard. I quote from C99:

Re: [BUGS] Inconsistent shift operator

2008-04-20 Thread Sam Mason
On Sat, Apr 19, 2008 at 11:26:57AM -0400, Tom Lane wrote: > Roman Kononov <[EMAIL PROTECTED]> writes: > > The below test cases show the obvious inconsistency between different > > integer types. > > [ shrug... ] The << and >> operators just expose the behavior of the > local C compiler's shift o

Re: [BUGS] Inconsistent shift operator

2008-04-19 Thread Tom Lane
Roman Kononov <[EMAIL PROTECTED]> writes: > The below test cases show the obvious inconsistency between different > integer types. [ shrug... ] The << and >> operators just expose the behavior of the local C compiler's shift operators, and it's clearly stated in the C spec that shifting by more