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


On 08/16/2012 06:56 PM, Michael Meeks wrote:
        Sure - everyone's spent time doing that; like looking for:

        if (a);
        {
                always_happens();
        }

...which contemporary compilers warn about, anyway. -- But sure, they could warn about the other case, too:

  if (a)
    sometimes_happens();
    // some deceptively indented comment
    always_happens();

        Well - it seems that as each person touches the code, and has a
different view they change the local scope. c'est la vie. I usually try
to go for consistency in the function / module.

        On that basis it's notable that you made that function inconsistent on
this topic :-)

Yes, using braces is one notable case where I deliberately deviate from existing practice in a given file. (Though not in the question of whether to place the opening brace on a line by itself, which can lead to that excessive-looking vertical whitespace.)

Anyway, even if we agree to disagree here, the devilishly deceiving cases I remember all involved if-sans-braces which originally covered a single statement plus comment (as above), so maybe we can agree that at least in such cases it doesn't harm to add redundant braces.

Stephan

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.