preprocessing directive with no new-line character

Jonathan Wakely jwakely.gcc@gmail.com
Tue Jul 18 22:33:00 GMT 2017


On 18 July 2017 at 21:46, Dennis Clarke wrote:
> Fascinating. I never would have thought that a zero line length file
> would be accepted as valid. However gcc ( older rev 4.9.2 ) will
> accept this :
>
> $ printf "int main ( int argc, char* argv[] ) { return 0; }" > tzero.c

Aside: why would you bother to declare parameters for such a program?
What's wrong with int main(void) ?

I wonder about this every time somebody reports a bug that gives
-Wunused-parameter warnings because of pointless unused parameters.

Since C99 (and in C++) you don't even need the return statement.

int main() { }



More information about the Gcc-help mailing list