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 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-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
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2005-12-01 21:31:12 | Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero. |
Previous Message | Bruce Momjian | 2005-12-01 21:16:14 | pgsql: Add comment to pg_atoi. |
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2005-12-01 21:31:12 | Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero. |
Previous Message | Pollard, Mike | 2005-12-01 21:14:11 | Re: generalizing the planner knobs |