Hello all,
I have a strange behaviour I can't explain with GCC (3.2.2), considering
the following piece of code (exit.c) :
/* snip */
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
0;
printf;
exit;
exit(1);
return 0;
}
/* snip */
When compiled with gcc -Wunused -Wunreachable-code exit.c I get these
warnings :
exit.c: In function `main':
exit.c:6: warning: statement with no effect
exit.c:7: warning: statement with no effect
So GCC detects lines 6 and 7, that's ok. But why didn't it print a
warning for lines 8 (exit with no args, equal to the value of exit
function pointer, useless) and 10 (return 0 after exit, will never be
executed) ?
This is the declaration of exit function (stdlib.h) :
__BEGIN_NAMESPACE_STD
extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
__END_NAMESPACE_STD