Re: GCC 3.4 Heads-up
From: Linus Torvalds
Date: Tue Jan 06 2004 - 18:25:03 EST
On Tue, 6 Jan 2004, Richard Henderson wrote:
>
> In ANSI C you've no alternative except memcpy, since you can't cast
> the pointer and reference the object via some other type (assuming
> neither type is char, yadda yadda).
Sure you have. You can _always_ change
(a ? b : c) = d;
to
tmp = d;
a ? (b = tmp) : (c = tmp);
which is not pretty, but with some macro abuse it won't be horrible. In
fact, once you do that, you might as well just do a real "if" statement.
Especially if you're going to continue to use (less odious) gcc-specific
stuff you can probably automate it fairly well with a replacement that
uses "typeof" and expresstion statements to do that "tmp" variable
properly.
Ie it might be _slightly_ more complex than running a "sed" script over
the sources, but it shouldn't be that much worse.
Linus
-
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/