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'?


"Neo Anderson" <neo_in_matrix@msn.com> writes:

> So, what is the purpose of this warning? What possible 'damages' does
> this warning protect against?

None.  Personally, I think the compiler should only issue this warning
with -pedantic.

> And, what is the 'the behavior'?

In this quote:

> > The C++ standard says: If a source file that is not empty does not end
> > in a newline character, or ends in a newline character immediately
> > preceded by a backslash character, the behavior is undefined. (2.1/1)

"the behavior" refers to the behavior of the compiler.  It means that
the standard does not specify how the compiler must behave when it
sees a non-empty file which does not end with a newline.

Ian


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