What is the purpose of 'warning: no newline at end of file'?
Eljay Love-Jensen
eljay@adobe.com
Thu Jul 7 15:23:00 GMT 2005
Hi Neo,
>#include "Foo.h"
>There is already a newline after it. What does the Standard say?
The standard says that if you do not put in a newline at the end of Foo.h, the behavior is undefined.
The preprocessor directive #include "Foo.h" *includes* the newline at end-of-line.
No preprocessor that I know of puts in EXTRA newlines when it expands the preprocessor directives. Putting in an EXTRA newline when the included file lacks one at the end-of-file is compiler specific (enhancement to standard) behavior.
Sincerely,
--Eljay
More information about the Gcc-help
mailing list