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

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.
Дата
Msg-id 20051201212050.GB6375@surnet.cl
обсуждение исходный текст
Ответ на Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Pollard, Mike"
Дата:
Сообщение: Re: generalizing the planner knobs
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Add comments about why errno is set to zero.