Chinaunix首页 | 论坛 | 博客
  • 博客访问: 955532
  • 博文数量: 120
  • 博客积分: 6454
  • 博客等级: 准将
  • 技术积分: 1739
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-28 17:45
文章分类

全部博文(120)

文章存档

2014年(1)

2013年(1)

2012年(11)

2011年(16)

2010年(6)

2009年(11)

2008年(30)

2007年(44)

分类: C/C++

2008-05-07 15:51:28

     GCC中如果文件最后不加上一行空行的话,就会吐个warning:no newline at end of file。
     在《》一文中,有C99的相关信息:

    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.

     为了一致性,代码的每一行后面都应该有一个“结束符”,也就是newline。避免当被include的文件展开后,前一个文件的最后一行与后一个文件的第一行直接被连接成一行从而造成错误。

     不过像Visual Stdio之类的IDE没有报错,大概是它们自己主动插入了“结束符”吧。

阅读(2278) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~