Missing braces get on my nerves.

Posted by Sitral on Fri 13 Dec 2002 07:39 AM — 1 posts, 8,939 views.

#0
Yes, I'm aware it compiles fine. Yes, I'm aware it runs fine. But watching three dozen warnings scroll by everytime I compile is very unsettling. So, has anyone bothered to fix these problems, or mind helping me do it?

For instance, here's one of the problems:
if ( pdesc != NULL )
if (++count == number)
{
send_to_char( pdesc, ch );
return;
}
else continue;

The spacing on this one suggests that the else is _included_ in the first if statement:
if ( pdesc != NULL )
{ /* Where the brace belongs? */
if (++count == number)
{
send_to_char( pdesc, ch );
return;
}
else continue;
} /* Where the brace belongs? */

Or is the else _part of_ the first if statement?:
if ( pdesc != NULL )
{ /* Where the brace belongs? */
if (++count == number)
{
send_to_char( pdesc, ch );
return;
}
} /* Where the brace belongs? */
else continue;

Like I said, from this example it seems clear that the first solution is right...but not each instance is spaced so well, so can anyone tell me which is right?