Skip site navigation (1)Skip section navigation (2)
Date:      25 Sep 1999 13:32:57 +0200
From:      Dag-Erling Smorgrav <des@flood.ping.uio.no>
To:        Neil Blakey-Milner <nbm@mithrandr.moria.org>
Cc:        Gregory Bond <gnb@itga.com.au>, hackers@FreeBSD.ORG
Subject:   Re: "style" question
Message-ID:  <xzpu2ojxm3a.fsf@flood.ping.uio.no>
In-Reply-To: Neil Blakey-Milner's message of "Fri, 17 Sep 1999 14:15:10 %2B0200"
References:  <199909170821.SAA15276@lightning.itga.com.au> <19990917141510.A85883@rucus.ru.ac.za>

next in thread | previous in thread | raw e-mail | index | archive | help
Neil Blakey-Milner <nbm@mithrandr.moria.org> writes:
> On Fri 1999-09-17 (18:21), Gregory Bond wrote:
> > I'm looking at cleaning up a few compile nits and I'm wondering what the
> > officially approved way of silencing "may not be used" warnings:
> > 
> > int
> > foo(int flag)
> > {
> >         int j;
> 	j = 0;
> >         if (flag) 
> >                 j = 1;
> > 
> 	return j;
> > }

Hmf, I just realized:

int
foo(int flag)
{
    return !!flag;
}

or

#define foo(x) (!!(x))

DES
-- 
Dag-Erling Smorgrav - des@flood.ping.uio.no


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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