Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On Mon, 2012-05-28 at 05:01 -0700, julien2412 wrote:
Before I create a tracker for cppcheck, I'd like to know at what corrrespond
these curly parenthesis.
I found nothing about this kind of construct in C++ however I know it's ok
since it compiles ok.

These add scope to the objects inside the {} e.g 

{
    FOO thing;
} //<-- thing's dtor is basically called here

so if you remove the scoping braces then the objects get destroyed later
on. If the initial developer stuck them in, then there's almost
certainly a very good reason the objects have to be destroyed at the
explicit end of scope. e.g. in your example xObjStg is the likely
special thing that must be destroyed right at the } and not continue to
live to the end of the prior enclosing if statement.

Worth going ahead and filing that cppcheck bug, and leave the .cxx
alone :-)

C.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.