What is the purpose of 'warning: no newline at end of file'?

Eljay Love-Jensen eljay@adobe.com
Thu Jul 7 11:35:00 GMT 2005


Hi Neo,

--- Foo.h ---
#ifndef Foo_H_ONCE
#define Foo_H_ONCE
extern int MyFoo;
#endif // Foo_H_ONCE<NO-NEWLINE>
--- --- ---

The "<NO-NEWLINE>" is a meta to indicate that there is no newline at the end of the file.

--- Foo.cpp ---
#include "Foo.h"
#include "Bar.h"
...yada yada yada...
--- --- ---

Is Bar.h supposed to be included?  Or is the comment-to-end-of-line at the end of Foo.h supposed to comment it out?

The behavior is undefined.

HTH,
--Eljay



More information about the Gcc-help mailing list