Re: Warnings in compile - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Warnings in compile
Date
Msg-id 2830.1243261180@sss.pgh.pa.us
Whole thread Raw
In response to Warnings in compile  (Michael Meskes <meskes@postgresql.org>)
Responses Re: Warnings in compile  (Michael Meskes <meskes@postgresql.org>)
List pgsql-hackers
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.

>   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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Doubt
Next
From: Zdenek Kotala
Date:
Subject: Re: [PATCH] Compiler warning cleanup