Re: [PATCH] Use more gcc extensions in the Linux headers

From: Linus Torvalds
Date: Fri Mar 09 2007 - 12:48:24 EST




On Fri, 9 Mar 2007, Christoph Hellwig wrote:
>
> It was only put in under the premise that they'll fix whatever breaks,
> we're not going to put any maintaince border on us to hack around
> broken propritary compilers.

Well, since Rusty's macro was hoddible *anyway*, I don't think I'd apply
it as-is. Breaking icc for something that ugly and not-very-important
simply makes no sense.

There are better ways to do this.

For one, you could (and should!) abstract these kinds of things out,
rather than put them in another macro that really does something totally
different. Then, the macro could have become

#define ARRAY_SIZE (sizeof_expression + 0*error_if_not_array)

which would already be a hell of a lot more readable. But more
importantly, it's also now suddenly much easiler to abstract out for
different compilers.

We *already* support different compilers through <linux/compiler.h>, and
there just isn't any reason for bad code just for bad codes sake!

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/