10-09-2008, 12:13 PM
The following
Can be coded as
to hide the "else if". Is this OK?
I think the code blocks are semantically identical but the last one does not list the else.
Brian
Code:
if ( x < 0 )
{
log_error(3);
x = 0;
}
else if ( y < 0 )
{
x = 3;
}
else
{
/* no change */
}
Can be coded as
Code:
if ( x < 0 )
{
log_error(3);
x = 0;
}
else
{
if ( y < 0 )
{
x = 3;
}
}
to hide the "else if". Is this OK?
I think the code blocks are semantically identical but the last one does not list the else.
Brian
<t></t>