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: corey taylor <corey dot taylor at gmail dot com>
- To: Jonathan Turkanis <technews at kangaroologic dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 6 Jul 2005 22:44:23 -0500
- Subject: Re: What is the purpose of 'warning: no newline at end of file'?
- References: <BAY106-F29F0AACDD78CDC3FD98900BDD80@phx.gbl> <42CCA460.8070009@kangaroologic.com>
- Reply-to: corey taylor <corey dot taylor at gmail dot com>
And that undefined behavior is in the form of that warning you've
posted. This simply lets you know what behavior the gcc developers
inserted.
You need the newline in order to have c++ standards behavior assumed
instead of gcc behavior -- it's a portability issue really.
corey
On 7/6/05, Jonathan Turkanis <technews@kangaroologic.com> wrote:
> Neo Anderson wrote:
> > I don't even think it's a problem. Why do I need (or better have) a line
> > ending?
>
> 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)
>
> Jonathan
>
>