[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwf2U-fp_k+U8R-68xi84cTwHyUUMZ+k-h4QK0QXdZffw@mail.gmail.com>
Date: Mon, 10 Mar 2014 20:05:38 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: David Miller <davem@...emloft.net>, ast@...mgrid.com,
dborkman@...hat.com, Ingo Molnar <mingo@...nel.org>,
Will Drewry <wad@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Hagen Paul Pfeifer <hagen@...u.net>,
Jesse Gross <jesse@...ira.com>,
Thomas Gleixner <tglx@...utronix.de>,
Eric Dumazet <edumazet@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Frédéric Weisbecker <fweisbec@...il.com>,
Arnaldo Carvalho de Melo <acme@...radead.org>,
penberg@....fi, Arjan van de Ven <arjan@...radead.org>,
Christoph Hellwig <hch@...radead.org>,
Pavel Emelyanov <xemul@...allels.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH v8 net-next 1/3] filter: add Extended BPF interpreter and converter
On Mon, Mar 10, 2014 at 7:33 PM, H. Peter Anvin <hpa@...or.com> wrote:
> Why not for variables?
My dislike of "bool" comes from the fact that you historically can't *trust* it.
I guess it's becoming trustworthy these days, but quite often,
traditionally, "bool" ended up being just another word for "char",
because compiler support for actual booleans was spotty, so you'd find
projects that had their own definition of bool along with true/false.
And at that point, all the advantages of "bool" fly out the window,
because they in fact act like "char" when people did that. So
sometimes they truncated to 8 bits, and sometimes they did the "true
bool thing" and acted like truth values.
I guess I haven't gotten over my hatred of people playing games with
them because support wasn't universal enough. But maybe it's
approaching being irrational these days.
Finally: it's actually horrible mixing bool with non-bool. That
*really* screws up code generation. So if you have one function with
the traditional "int" 0/1 return style, and you use that in a function
that uses it as "bool", you'll find the compiler adding compares with
zero etc.
So I'm not a huge fan. I'm not saying bool is horribly wrong, but it
really can cause issues, and the advantages aren't really all that
obvious.
Linus
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists