Re: Warnings in compile - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: Warnings in compile
Date
Msg-id 20090525152154.GA27197@feivel.credativ.lan
Whole thread Raw
In response to Re: Warnings in compile  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Warnings in compile  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, May 25, 2009 at 10:19:40AM -0400, Tom Lane wrote:
> Michael Meskes <meskes@postgresql.org> writes:
> > - some combination of signed and unsigned: ~ 600
> >   Are we really sure that *all* compilers out there do handle this correctly?
> 
> The behavior is spelled out in the C spec, and always has been.  You
> might as well worry if they handle "if" correctly.

Well this is probably because I got bitten by this once. Okay, granted it was
very long ago and the compiler was not state of the art.

> >   There are some #defines of the form 
> >   #define foo if(1) { ... } else
> >   that are called as foo;
>   
> >   I see the need for the macro to expand as block, but what use hase the empty
> >   else?
> 
> That sounds both dangerous and against our coding conventions.  The
> standard way to do that is "do { ... } while (0)"

Which won't work here as the macros have continue and break commands in them. 

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!


pgsql-hackers by date:

Previous
From: "Massa, Harald Armin"
Date:
Subject: Re: generic options for explain
Next
From: Tom Lane
Date:
Subject: Re: generic options for explain