免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 5566 | 回复: 11
打印 上一主题 下一主题

[C++] gcc有没有 extern "C++"用法? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-08-09 18:10 |只看该作者 |倒序浏览
gcc有没有 extern "C++"用法?

论坛徽章:
0
2 [报告]
发表于 2007-08-09 18:30 |只看该作者
没见到过, 不过C++与C的混合编译都是采用
extern "C"的方式.不管是C++中调用C还是C中调用C++.

论坛徽章:
0
3 [报告]
发表于 2007-08-09 18:46 |只看该作者
不知道,原则上讲C没必要兼容C++

论坛徽章:
0
4 [报告]
发表于 2007-08-09 19:15 |只看该作者
通常来说都是先学C,再学C++,所以,会C++会C,会C的不一定会C++

论坛徽章:
0
5 [报告]
发表于 2007-08-09 19:25 |只看该作者
会C++的也不一定会C
绝不要相信"C是C++子语言"的鬼话

原帖由 ssafa 于 2007-8-9 19:15 发表
通常来说都是先学C,再学C++,所以,会C++会C,会C的不一定会C++

论坛徽章:
0
6 [报告]
发表于 2007-08-09 22:37 |只看该作者
原帖由 ypxing 于 2007-8-9 19:25 发表
会C++的也不一定会C
绝不要相信"C是C++子语言"的鬼话


为什么不要相信"C是C++子语言"?
单单就语言而言,C就是C++的子集嘛

论坛徽章:
0
7 [报告]
发表于 2007-08-09 22:49 |只看该作者
给你举个小例子:

++i 在C和C++中的一个区别
http://bbs.chinaunix.net/viewthr ... mp;highlight=ypxing

原帖由 xujg 于 2007-8-9 22:37 发表

为什么不要相信"C是C++子语言"?
单单就语言而言,C就是C++的子集嘛

论坛徽章:
0
8 [报告]
发表于 2007-08-10 00:43 |只看该作者
会C++不会C的, 估计C++也稀松.  C书里详细介绍的东西,C++书里普遍不会全面详细的介绍,
n多C++的preface里都说"至少需要一定的C知识"

论坛徽章:
0
9 [报告]
发表于 2007-08-10 01:33 |只看该作者

回复 #1 ATmega32 的帖子

有。
info gcc     第六节

6 Extensions to the C++ Language
********************************

The GNU compiler provides these extensions to the C++ language (and you
can also use most of the C language extensions in your C++ programs).
If you want to write code that checks whether these features are
available, you can test for the GNU compiler the same way as for C
programs: check for a predefined macro `__GNUC__'.  You can also use
`__GNUG__' to test specifically for GNU C++ (*note Predefined Macros:
(cpp)Common Predefined Macros.).

* Menu:

* Volatiles::           What constitutes an access to a volatile object.
* Restricted Pointers:: C99 restricted pointers and references.
* Vague Linkage::       Where G++ puts inlines, vtables and such.
* C++ Interface::       You can use a single C++ header file for both
                        declarations and definitions.
* Template Instantiation:: Methods for ensuring that exactly one copy of
                        each needed template instantiation is emitted.
* Bound member functions:: You can extract a function pointer to the
                        method denoted by a `->*' or `.*' expression.
* C++ Attributes::      Variable, function, and type attributes for C++ only.
* Strong Using::      Strong using-directives for namespace composition.
* Java Exceptions::     Tweaking exception handling to work with Java.
* Deprecated Features:: Things will disappear from g++.
* Backwards Compatibility:: Compatibilities with earlier definitions of C++.

论坛徽章:
0
10 [报告]
发表于 2007-08-10 16:34 |只看该作者
郭德纲?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP