Re: Strange interval arithmetic - Mailing list pgsql-hackers

From Michael Fuhr
Subject Re: Strange interval arithmetic
Date
Msg-id 20051130225319.GA27518@winnie.fuhr.org
Whole thread Raw
In response to Re: Strange interval arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Nov 30, 2005 at 05:23:23PM -0500, Tom Lane wrote:
> Michael Fuhr <mike@fuhr.org> writes:
> > I usually check both in my own code but I noticed several places
> > where PostgreSQL doesn't, so I kept that style.  I'll check both
> > if that's preferred.
> 
> I'd say not --- it's more code and it makes a possibly unwarranted
> assumption about strtol's behavior.

OTOH, it might be an unwarranted assumption that ERANGE alone
indicates error.  It's possible that on some system errno's value
is meaningless unless strtol() returns one of the documented
indicators (LONG_MAX or LONG_MIN).  I've seen system calls that
behave that way: errno might get set in a non-error situation due
to the underlying implementation (e.g., wrappers around socket
functions in userland thread implementations), but the programmer
has no business looking at errno unless the function returns -1.

-- 
Michael Fuhr


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Strange interval arithmetic
Next
From: Michael Fuhr
Date:
Subject: Re: Strange interval arithmetic