[Scummvm-devel] Nested scopes in scummvm code.

Johannes Schickel lordhoto at scummvm.org
Wed Sep 16 13:18:02 CEST 2009


Eugene Sandulenko wrote:
> 2009/9/16 Vladimir Menshakov <whoozle at yandex.ru>:
>   
>> 16.09.09, 02:41, "Johannes Schickel" <lordhoto at scummvm.org>:
>>
>>     
>>> megath at users.sourceforge.net wrote:
>>>       
>>>> @@ -356,9 +356,13 @@
>>>>                     }
>>>>             }
>>>>
>>>> -           if (!hide_actor) {
>>>> +           {
>>>>                     Surface *mark = actor_animation.currentFrame();
>>>>
>>>>         
>>> That's also violating our code formatting guidelines ;-). Maybe you
>>> should read all of them again.
>>> // Johannes
>>>       
>> Imagine that there's hidden "if (true) {" . Is there guidelines for nested scopes in scummvm code convention? Minor issue that has to be cleared.
>>     
> That is correct indentation. It would be nice if somebody update our
> conventions. In fact, it is widely used in switch() statements all
> around the code. That is (ignore the tabs):
>
>    someCode();
>
>    a += 1;
>
>    {
>        int foo;
>
>        foo = 5;
>    }
>
>    someMoreCode();
>
>   

Whoops actually I guess I was too tired, I didn't see that the "if" was 
removed. Sorry :-).

But for switch statements we do use:

switch (foo) {
case 0: {
    } break;
default:
    break;
}

or

switch (foo) {
case 0: {
    }
    break;
default:
    break;
}

and not

switch (foo) {
case 0:
    {
    } break;
default:
    break;
}

or

switch (foo) {
case 0:
    {
    }
    break;
default:
    break;
}

AFAIK.

// Johannes




More information about the Scummvm-devel mailing list