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


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


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