Re: GCC 3.4 Heads-up
From: Bill Davidsen
Date: Fri Jan 02 2004 - 17:17:31 EST
Linus Torvalds wrote:
Actually, those language extensions (while documented for a long time) are
pretty ugly.
Some of that ugliness turns into literal bugs when C++ is used.
The cast/conditional expression as lvalue are _particularly_ ugly
extensions, since there is absolutely zero point to them. They are very
much against what C is all about, and writing something like this:
a ? b : c = d;
is something that only a high-level language person could have come up
with. The _real_ way to do this in C is to just do
*(a ? &b : &c) = d;
which is portable C, does the same thing, and has no strange semantics.
I would probably write
( a ? b : c ) = d;
instead, having learned C when some compilers parsed ? wrong without
parens. Actually I can't imagine writing that at all, but at least with
parens humans can read it easily. Ugly code.
Your suggestion is not portable, if b or c are declared "register" there
are compilers which will not allow taking the address, and gcc will give
you a warning.
--
bill davidsen <davidsen@xxxxxxx>
CTO TMR Associates, Inc
Doing interesting things with small computers since 1979
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/