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: What is the purpose of 'warning: no newline at end of file'?


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


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