lkml.org 
[lkml]   [2004]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: GCC 3.4 Heads-up


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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.045 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site