[Cryptography] The GOTO Squirrel! [was GOTO Considered Harmful]
Patrick Chkoreff
patrick at rayservers.net
Mon Mar 3 15:01:10 EST 2014
> Both gcc and llvm have this warning turned off by default, at least
> for C. In fact, neither of them have it as part of -Wall - you have
> to explicitly request it (-Wunreachable-code). From the
> documentation: "This option is not made part of -Wall because in a
> debugging version of a program there is often substantial code which
> checks correct functioning of the program and is, hopefully,
> unreachable because the program does work. Another common use of
> unreachable code is to provide behavior which is selectable at
> compile-time."
Yes, and I did an experiment with Ian's "moo" program. All of the
following compiled just fine, without warning:
$ gcc -Wunreachable-code moo.c
$ gcc -Wunreachable-code -Wall moo.c
$ gcc -Wunreachable-code -Wall --std=c99 moo.c
$ gcc -Wunreachable-code -Wall --std=c99 --pedantic moo.c
$ gcc -Wunreachable-code -Wall --std=c99 --pedantic -ansi moo.c
$ gcc -Wunreachable-code -Wall --pedantic -ansi moo.c
I'm not even sure how to make the unreachable-code option do *anything* yet!
-- Patrick
P.S. Source code, courtesy Ian Grigg, no warranty express or implied:
#include <stdio.h>
int main(int argv, char **p)
{
printf("hello world\n");
goto happy;
printf("hello black hole\n");
happy:
return 0;
}
Compiler version:
$ gcc --version
gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
More information about the cryptography
mailing list