bluebones.net

Icon

Adventures in Computer Programming

Newlines at the end of files

For

Against

  • git considers a trailing newline a whitespace error.
  • Trailing whitespace is easily lost when, for example, exchanging patches via email.
  • A newline after a closing “?>” in PHP can cause problems with header() (although closing tags are no longer required in PHP).
  • It uses one more byte.

Category: Uncategorized

Tagged:

One Response

  1. Paul says:

    For: POSIX compliance

    http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html

    3.205 Line

    A sequence of zero or more non- characters plus a terminating character.

    3.395 Text File

    A file that contains characters organized into zero or more lines. The lines do not contain NUL characters and none can exceed {LINE_MAX} bytes in length, including the character. Although POSIX.1-2008 does not distinguish between text files and binary files (see the ISO C standard), many utilities only produce predictable or meaningful output when operating on text files. The standard utilities that have such restrictions always specify “text files” in their STDIN or INPUT FILES sections.

Leave a Reply