Randoms
#10

Quote:
Originally Posted by ******
Посмотреть сообщение
I'm not sure what you mean by that.
I've referenced him to look at some code optimizations. In particular, after an instruction given, follows a statement or function. Braces aren't required nor without braces are not ideal when a single statement follows that same instruction.

Quote:
Originally Posted by ******
That is the code I was referring to as "squashed".
You say the second is more 'clarified' than the first?

pawn Код:
new decide = random(2);
if(decide == 0) return EVENT_TEAM_RED;
else if(decide == 1) return EVENT_TEAM_BLUE;
pawn Код:
new decide = random(2);
if(decide == 0)
{
    return EVENT_TEAM_RED;
}
else if(decide == 1)
{
    return EVENT_TEAM_BLUE;
}
Quote:
Originally Posted by ******
If you are arguing that grouping single statements as compound statements is easier to read (as your posts seem to indicate, though I'm not too clear on what you're trying to say) then I really do disagree, but you're free to do it that way - I was just pointing out that it's not a code optimisation issue, just a layout issue.
*If I've understood your post correctly, then no this is NOT what I have been saying at all. Grouping single statements without braces (which would NOT be a compound statement) is what I have been saying. You are also free to disagree, but you state that the second example provided (which is my assumption) is more understandable than the first which I must also disagree.
Reply


Messages In This Thread
Randoms - by Rob_Maate - 02.12.2011, 11:40
Re: Randoms - by Sinc - 02.12.2011, 11:49
Re: Randoms - by Kostas' - 02.12.2011, 11:49
Re: Randoms - by Sinc - 02.12.2011, 11:53
Re: Randoms - by Rob_Maate - 02.12.2011, 12:08
Re: Randoms - by titanak - 02.12.2011, 12:11
Re: Randoms - by Rob_Maate - 02.12.2011, 12:39
Re: Randoms - by Sinc - 02.12.2011, 12:47
Re: Randoms - by Dark_Kostas - 02.12.2011, 13:31
Re: Randoms - by Sinc - 02.12.2011, 13:43

Forum Jump:


Users browsing this thread: 4 Guest(s)