Re: sparse segfaults

Linus Torvalds
2004-11-22T18:58:18Z

On Mon, 22 Nov 2004, Mitchell Blank Jr wrote:
>
> When I want to do that I just use:
>
> #define MAX_SOMETHING (max_of_something + 0)

Yes, I think I've done that too, and that works. My point is that the
silly comma-expression should _also_ work, and I don't see any _valid_ use
of the comma-expression as an lvalue.

I suspect (but don't have any real argument to back that up) is that the
gcc "extended lvalues" fell out as a side effect from how gcc ended up
doing some random semantic tree parsing, and it wasn't really "designed"
per se, as much as just a random implementation detail. Then somebody
noticed it, and said "cool" and documented it.

That's actually in my opinion a really good way to occasionally find a
more generic form of something - the act of noticing that an algorithm
just happens to give unintentional side effects that can actually be
mis-used. So I don't think that it's a bad way per se to add features,
especially as they then are often free (or even "negative cost", since
_not_ adding the feature would entail having to add a check against it).

And for all I know, many of the _good_ gcc features ended up being done
that way too.

But I think the (unintentional) downsides of these features are bigger
than the advantages.

Linus