Re: Warnings in compile

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Warnings in compile
Date: 2009-05-25 14:19:40
Message-ID: 2830.1243261180@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

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

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2009-05-25 14:52:07 Re: [PATCH] Compiler warning cleanup
Previous Message Robert Haas 2009-05-25 14:16:34 Re: Doubt