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

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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,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:20:51
Message-ID: 20051201212050.GB6375@surnet.cl (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackers
Bruce Momjian wrote:
> Tom Lane wrote:

> > > 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);

May I vote against this kind of use of macros in general?  It doesn't
add much value (actually, none in this case) and it makes the code
harder to read.  For a pathological example I can point to PHP, which is
so full of strange macros that it's very very hard to read.

Of course there are places where macros are valuable tools, but this
doesn't seem to be one of them.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

pgsql-hackers by date

Next:From: Martijn van OosterhoutDate: 2005-12-01 21:31:12
Subject: Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.
Previous:From: Pollard, MikeDate: 2005-12-01 21:14:11
Subject: Re: generalizing the planner knobs

pgsql-committers by date

Next:From: Martijn van OosterhoutDate: 2005-12-01 21:31:12
Subject: Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.
Previous:From: Bruce MomjianDate: 2005-12-01 21:16:14
Subject: pgsql: Add comment to pg_atoi.

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