no newline at end of file是什么问题?

johnx123 2008-03-18 12:51:29
no newline at end of file
gcc4.1编译的warning. 什么问题?
...全文
635 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
abupie 2008-03-18
  • 打赏
  • 举报
回复
啊,csdn的换行有问题啊....
css没有写好。加个word-break把。。
abupie 2008-03-18
  • 打赏
  • 举报
回复
C99第5.1.1.2节这样写道:
Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. Only the last backslash on any physical source line shall be eligible for being part of such a splice. A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any such splicing takes place.
C99 Rationale中进一步指出:
A backslash immediately before a newline has long been used to continue string literals, as well as preprocessing command lines. In the interest of easing machine generation of C, and of transporting code to machines with restrictive physical line lengths, the C89 Committee generalized this mechanism to permit any token to be continued by interposing a backslash/newline sequence.
这么规定的初衷有两个:一是为了每一行都要以换行结束。二是,因为行尾的\表示连接下一行,如果一个文件最后一行行尾有\,那么,紧跟它也被包含进来的下一个源文件的第一行就会被连接!而如果一个文件以一个空行结束就会避免这种情况的发生。
ttlyfast 2008-03-18
  • 打赏
  • 举报
回复
独孤过儿 2008-03-18
  • 打赏
  • 举报
回复
你只要在你的代码最后加一个空行,这个warning就没有了...
Treazy 2008-03-18
  • 打赏
  • 举报
回复
这个warning可以直接忽略不计,基本上没什么大用处!
liyuzhu_1984 2008-03-18
  • 打赏
  • 举报
回复
如果是在linux下编成 那么这个问题就是说,你编写的代码要在最后加一个换行 我以前写的程序也遇到了这样的问题
具体为什么 我也不知道

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧