[Bug c++/29834] g++ thinks it is a declaration when it cannot be

james dot kanze at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 15 10:10:00 GMT 2006



------- 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



More information about the Gcc-bugs mailing list