Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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: Wed, 30 Nov 2005 15:53:20 -0700
  • Message-id: <20051130225319(dot)GA27518(at)winnie(dot)fuhr(dot)org>

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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group