Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jan 2011 20:11:42 +0100
From:      Gary Jennejohn <gljennjohn@googlemail.com>
To:        Alexander Best <arundel@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: empty function macros
Message-ID:  <20110130201142.09f4b998@ernst.jennejohn.org>
In-Reply-To: <20110130172941.GA10701@freebsd.org>
References:  <20110130172941.GA10701@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 30 Jan 2011 17:29:41 +0000
Alexander Best <arundel@freebsd.org> wrote:

> hi there,
> 
> i noticed freebsd has a few of the following macros:
> 
> #define FUNC(sb)
> 
> when you do something like
> 
> if (cond)
>     FUNC(i)
> 
> the compiler complains about an if statement with an empty body. any sensible
> way of dealing with this issue?
> 
> i saw some reiserfs code which does the following to silence compilers:
> 
> #define FUNC(sb) do { } while (0)
> 

What happens if you treat it like a real function call and put ';'
after it?

-- 
Gary Jennejohn (gj@)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110130201142.09f4b998>