B
Boltar
By accident I came across a bug like this in some Linux code I'd
written today. All that had happened is I forgot the "else" yet the
code still compiled and ran. A simplified example is below.
#include <stdio.h>
main()
{
int a;
if (1 == 1) a = 1;
{
a = 2;
}
printf("a = %d\n",a);
}
When run it will print "a = 2". Should it compile at all or is GCCs
parser broken?
B2003
written today. All that had happened is I forgot the "else" yet the
code still compiled and ran. A simplified example is below.
#include <stdio.h>
main()
{
int a;
if (1 == 1) a = 1;
{
a = 2;
}
printf("a = %d\n",a);
}
When run it will print "a = 2". Should it compile at all or is GCCs
parser broken?
B2003