“No newline at end of file” compiler warning

后端 未结 11 1008
逝去的感伤
逝去的感伤 2020-11-27 09:50

What is the reason for the following warning in some C++ compilers?

No newline at end of file

Why should I have an empty line at

11条回答
  •  感动是毒
    2020-11-27 10:29

    The answer for the "obedient" is "because the C++03 Standard says the behavior of a program not ending in newline is undefined" (paraphrased).

    The answer for the curious is here: http://gcc.gnu.org/ml/gcc/2001-07/msg01120.html.

提交回复
热议问题