注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

liangxh2008的博客

 
 
 

日志

 
 

The difference between c ,cpp,cc,cc  

2010-05-13 13:34:18|  分类: c,c++ |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
Johs
Guest
 
Posts: n/a
#1: Apr 19 '07
I have read various tutorials on the net on c++ and sometimes they use
..cc as extension to files and other times they use .cpp or even just .c.
Are there no strict rules for naming of sourcefiles?



Zeppe
Guest
 
Posts: n/a
#2: Apr 19 '07

re: cpp or cc extension?


Johs wrote:
I have read various tutorials on the net on c++ and sometimes they use
.cc as extension to files and other times they use .cpp or even just .c.
Are there no strict rules for naming of sourcefiles?
There are no strict rules AFAIK, but there are de-facto standard. That is:
- c source files: c
- c header files: h
- c++ source files: cpp, cc, cxx
- c++ header files: h, hh, hpp

at least for the most common. I won't use the c extension for a cpp
program, because many compilers that compile both c and c++ interpret
the file as a c source if it has the c extension. For the header files
there is any problem indeed because the keep the context of the
translation unit in which they are included.

Regards,

Zeppe
  评论这张
 
阅读(843)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017