Why should text files end with a newline?

后端 未结 18 1217
栀梦
栀梦 2020-11-21 22:56

I assume everyone here is familiar with the adage that all text files should end with a newline. I\'ve known of this \"rule\" for years but I\'ve always wondered — why?

18条回答
  •  被撕碎了的回忆
    2020-11-21 23:26

    I personally like new lines at the end of source code files.

    It may have its origin with Linux or all UNIX systems for that matter. I remember there compilation errors (gcc if I'm not mistaken) because source code files did not end with an empty new line. Why was it made this way one is left to wonder.

提交回复
热议问题