Re: Warnings in compile

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Warnings in compile
Date: 2009-05-25 15:21:54
Message-ID: 20090525152154.GA27197@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, May 25, 2009 at 10:19:40AM -0400, Tom Lane wrote:
> Michael Meskes <meskes(at)postgresql(dot)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(at)jabber(dot)org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-05-25 15:22:24 Re: generic options for explain
Previous Message Massa, Harald Armin 2009-05-25 15:15:25 Re: generic options for explain