Re: Strange interval arithmetic

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Strange interval arithmetic
Date: 2005-11-30 22:53:20
Message-ID: 20051130225319.GA27518@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Wed, Nov 30, 2005 at 05:23:23PM -0500, Tom Lane wrote:
> Michael Fuhr <mike(at)fuhr(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-11-30 22:57:42 Re: Strange interval arithmetic
Previous Message Tom Lane 2005-11-30 22:49:53 Re: Strange interval arithmetic

Browse pgsql-patches by date

  From Date Subject
Next Message Michael Fuhr 2005-11-30 22:57:42 Re: Strange interval arithmetic
Previous Message Tom Lane 2005-11-30 22:49:53 Re: Strange interval arithmetic