This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: What is the purpose of 'warning: no newline at end of file'?
- From: Ian Lance Taylor <ian at airs dot com>
- To: "Neo Anderson" <neo_in_matrix at msn dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: 06 Jul 2005 21:32:18 -0700
- Subject: Re: What is the purpose of 'warning: no newline at end of file'?
- References: <BAY106-F193FD8531E7F331E4E3008BDD80@phx.gbl>
"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