Why is it recommended to have empty line in the end of a source file?

Petteri H picture Petteri H · Feb 18, 2010 · Viewed 48.3k times · Source

Some code style tools recommend this and I remember seeing some unix command line tools warning about missing empty line.

What is the reasoning for having an extra empty line?

Answer

Ralph M. Rickenbach picture Ralph M. Rickenbach · Feb 18, 2010

Many older tools misbehave if the last line of data in a text file is not terminated with a newline or carriage return / new line combination. They ignore that line as it is terminated with ^Z (eof) instead.