From: Linus Torvalds <torvalds@osdl.org>
To: Mitchell Blank Jr <mitch@sfgoth.com>
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>,
Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: sparse segfaults
Date: Mon, 22 Nov 2004 10:54:17 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.58.0411221047140.20993@ppc970.osdl.org> (raw)
In-Reply-To: <20041122183956.GA50325@gaz.sfgoth.com>
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
next prev parent reply other threads:[~2004-11-22 18:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-20 14:37 Russell King
2004-11-20 16:58 ` Linus Torvalds
2004-11-20 17:23 ` Russell King
2004-11-21 22:10 ` linux-os
2004-11-21 22:29 ` Nikita Danilov
2004-11-21 22:37 ` Linus Torvalds
2004-11-21 22:44 ` Jan Engelhardt
2004-11-21 23:43 ` Mitchell Blank Jr
2004-11-22 1:02 ` Linus Torvalds
2004-11-22 10:33 ` Jan Engelhardt
2004-11-22 16:22 ` Linus Torvalds
2004-11-22 18:21 ` Jan Engelhardt
2004-11-22 18:39 ` Mitchell Blank Jr
2004-11-22 18:54 ` Linus Torvalds [this message]
2004-11-22 20:30 ` Duncan Sands
2004-11-23 13:59 ` Nix
2004-11-22 19:16 ` Linus Torvalds
2005-03-26 22:48 Jan Engelhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.58.0411221047140.20993@ppc970.osdl.org \
--to=torvalds@osdl.org \
--cc=jengelh@linux01.gwdg.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mitch@sfgoth.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®