This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29834] g++ thinks it is a declaration when it cannot be
- From: "james dot kanze at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Nov 2006 10:10:27 -0000
- Subject: [Bug c++/29834] g++ thinks it is a declaration when it cannot be
- References: <bug-29834-9635@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from james dot kanze at gmail dot com 2006-11-15 10:10 -------
Subject: Re: g++ thinks it is a declaration when it cannot be
On 15 Nov 2006 01:59:33 -0000, bangerth at dealii dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
> > (Note that in the actual code, Doh was
> > boost::mutex::scoped_lock. And I fear that using
> > boost::mutex::scoped_lock like this is becoming a widespread
> > idiom.)
> Ugh, this isn't an easy to read idiom...
Not sure I like it myself. It has two advantages: you don't
have to invent a name for a variable that you are never going to
use, and you don't have to add braces to limit the scope of the
lock. Very meager advantages, IMHO: it doesn't bother me to
just throw in any short name (e.g. 'l') in such cases, and if
the function is large enough to require the extra braces, it's
probably too large and complicated anyway.
But I'm not the only programmer in the world, and some people
seem to actually like it. And... I'll use it too, in quick
hacks in throw-away code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29834