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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



#include "Foo.h"

There is already a newline after it. What does the Standard say?

----Original Message Follows----
From: Eljay Love-Jensen <eljay@xxxxxxxxx>
To: Neo Anderson <neo_in_matrix@xxxxxxx>, gcc-help@xxxxxxxxxxx
Subject: Re: What is the purpose of 'warning: no newline at end of  file'?
Date: Thu, 07 Jul 2005 06:38:09 -0500

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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux