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

Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.
Date: 2005-12-01 21:00:15
Message-ID: 200512012100.jB1L0FS26208@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackers
Tom Lane wrote:
> momjian(at)postgresql(dot)org (Bruce Momjian) writes:
> > Log Message:
> > -----------
> > Add comments about why errno is set to zero.
> 
> These comments seem a bit wrongheaded, since "checking
> LONG_MIN/LONG_MAX" is exactly not what we could do to detect an overflow
> error.

Yea, I noticed the 0 was listed as another value that needs to be
checked.  Should I just change them all to:

	errno = 0;  /* avoid checking result for failure */

or should I add a macro to c.h as:

	/* Sometimes we need to clear errno so we can check errno
	 * without having to check for a failure value from the function
	 * call.
	 */	
	#define CLEAR_ERRNO \\
	do { \
		errno = 0; \\
	while (0);


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2005-12-01 21:01:34
Subject: Re: generalizing the planner knobs
Previous:From: Greg StarkDate: 2005-12-01 20:54:42
Subject: Re: generalizing the planner knobs

pgsql-committers by date

Next:From: Tom LaneDate: 2005-12-01 21:06:20
Subject: Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.
Previous:From: Tom LaneDate: 2005-12-01 20:53:34
Subject: Re: pgsql: Add comments about why errno is set to zero.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group