Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jan 2017 12:43:07 -0800
From:      Adrian Chadd <adrian@freebsd.org>
To:        Ian Lepore <ian@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r312236 - head/sys/net80211
Message-ID:  <CAJ-VmomFOgi=subpa0A=adBUJfGJLKfnBWuSYcx6b3x%2BKTtXNA@mail.gmail.com>
In-Reply-To: <1484510213.86335.110.camel@freebsd.org>
References:  <201701151949.v0FJnl2h027169@repo.freebsd.org> <1484510213.86335.110.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 15 January 2017 at 11:56, Ian Lepore <ian@freebsd.org> wrote:

>
> What is the point of the !! in these macros?  The expressions already
> have boolean type (even in C++ where it matters) due to the ==.
>  Removing the !! would also make one level of parens redundant.

It's just a habit i picked up from linux-land. That way it really is
only 1 or 0, so things like debugging output and such make easier
sense.

It's also fixed a handful of bugs in the past (but I can't think of
exact cases right now) - primarily where other code expected 1 or 0
(for things like shifts into protocol fields) and the macro returns 0
or ${LARGEVAL}.



-adrian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmomFOgi=subpa0A=adBUJfGJLKfnBWuSYcx6b3x%2BKTtXNA>