Bug #8854 2006-09-21 14:46

koala01

warning: no newline at end of file

during compilation, this warning appears systematically if there is not a blank line after the last significant one

it would seem that the compiler wants a character \ N before the EOF one

usign windows version, problem present on RC2 and nigthy builds before 2006-09-18 (included)

Category
Compiler
Group
 
Status
Closed
Close date
2006-09-23 10:55
Assigned to
 
thomasdenk 2006-09-23 10:55

Thank you for reporting.

This is not a bug, it is a feature of gcc. Being pedantic, if you don't have a newline at the end of the file, it is your code that contains a bug ;)

A newline is required by the standard to ensure that some very old compilers which would fail in some scenarios (don't remember which ones exactly) are able to compile sources.

Modern compilers don't need this, and most indeed give a **** about it, but gcc nevertheless enforces it for standard compliance.

The development version of Code::Blocks (see nightly builds) contains a workaround for this problem. If the option in the editor settings is enabled, it will make sure that all source files contain a terminating newline by secretly adding one if it is missing.