This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: preprocessing directive with no new-line character


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() { }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]