I recently appeared in C ++ code, for example:
if(test_1)
if(test_2)
{
}
else
exit(0);
This is ambiguous, as the compiler could see it as:
if(test_1)
{
if(test_2)
{
}
else
{
}
}
or how:
if(test_1)
{
if(test_2)
{
}
}
else
{
}
Is the behavior of this code defined in accordance with any standard (C, C ++)? I saw this code in C ++, a VC ++ program that seems to have preferred the first solution.
source
share