From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds To: aoliva@redhat.com, gcc@gcc.gnu.org Subject: Re: GCC's statement expression extension Date: Sun, 30 Jul 2000 11:23:00 -0000 Message-id: <200007301822.LAA02239@penguin.transmeta.com> References: <3981F647.2FBFFD19@apple.com> <20000728224030N.mitchell@codesourcery.com> <20000729104258V.mitchell@codesourcery.com> X-SW-Source: 2000-07/msg00994.html In article < orvgxolqo1.fsf@guarana.lsd.ic.unicamp.br > you write: > >Maybe the way to go is to require statement expressions to contain >explicit `return' statements, at least in C++. This would at least >make it easier to support them in C++. Is `return' currently usable >within statement expressions? I think this would be a _wonderful_ rule. Yes, it would break current practice and require changes. But it would make a ton of sense, and I always thought that the "use the last value" rule was a bit ugly (yes, I realize that is how K&R C compilers actually _used_ to work even for normal functins, and that "return" wasn't actually required back in the Elder Days. Even so, requiring a "return" statement at the end of functions was a GoodThing(tm), and would be a good thing for statement expressions too). If adding an explicit "return", and really making statement expressions look more like "anonymous inline functions" would be all it took to make them more palatable to C++, then I think this is definitely worth doing. Much better than just getting rid of them. An dit would make them cleaner in C too. (And by making it warn about missing returns, it would be really easy to fix up existing code even for people who weren't aware of the change) Linus