C程序是标准的C ++程序吗? [英] C program is standard C++ program?

查看:59
本文介绍了C程序是标准的C ++程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想如果C程序是标准的C ++程序,反之则不然

是一个正确的陈述吗?


在C ++中程序,我们可以使用标准的C库。但是,我们不能在b程序中使用C ++库。


请指教。谢谢!!

I want if "a C program is a standard C++ program, but not vice versa"
is a correct statement?

In a C++ program, we can use standard C libraries. However, we cannot
use C++ libraries inside C program.

Please advise. thanks!!

推荐答案

st * *****@gmail.com 写道:
我想如果C程序是标准的C ++程序,反之则不然
是正确的陈述?


No.


无效模板()

{

}


int main()

{

template();

}


是一个有效的C,但无效的C ++。检查你最喜欢的教科书(你这么做是否b $ b有一个,不是吗?)或google获取更多关于C和C ++的信息

不兼容性。

在C ++程序中,我们可以使用标准C库。但是,我们不能在C程序中使用C ++库。
I want if "a C program is a standard C++ program, but not vice versa"
is a correct statement?
No.

void template()
{
}

int main()
{
template();
}

is a valid C, but invalid C++. Check your favorite textbook (you do
have one, don''t you?) or google for more informations on C and C++
incompatibilities.
In a C++ program, we can use standard C libraries. However, we cannot
use C++ libraries inside C program.




这取决于你所谓的C ++库。


extern" C"

{

void f();

}


这是一个C ++库吗?如果是,那么C程序可以使用一些C ++

库。你的问题太模糊了。

Jonathan



It depends on what you call a "C++ library".

extern "C"
{
void f();
}

Is this a "C++ library"? If yes, then a C program can use some C++
libraries. Your question is too vague.
Jonathan


在comp.lang.c ++ st ****** @ gmail.com 写道:
In comp.lang.c++ st******@gmail.com wrote:
我想如果C程序是标准的C ++程序,但是反之亦然
是正确的陈述?


在大多数情况下,是的,但有一些情况并非如此。

例如,如果C程序声明现在的标识符C ++

关键字,但不是C关键字。 TC ++ PL在这个

主题上有一节。

在C ++程序中,我们可以使用标准C库。但是,我们不能在C程序中使用C ++库。
I want if "a C program is a standard C++ program, but not vice versa"
is a correct statement?
In most cases, yes, but there are a few cases where this is not true.
For example, if a C program declares identifiers that are now C++
keywords but that are not C keywords. TC++PL has a section on this
topic.
In a C++ program, we can use standard C libraries. However, we cannot
use C++ libraries inside C program.




True。


-

Marcus Kwok



True.

--
Marcus Kwok


>在comp.lang.c ++中 st******@gmail.com 写道:
> In comp.lang.c++ st******@gmail.com wrote:
在C ++程序中,我们可以使用标准C库。但是,我们不能在C程序中使用C ++库。
In a C++ program, we can use standard C libraries. However, we cannot
use C++ libraries inside C program.



在comp.lang.c ++ Marcus Kwok< ri ****** @ gehennom.net>写道:是的。


In comp.lang.c++ Marcus Kwok <ri******@gehennom.net> wrote: True.




阅读Jonathan的帖子之后,我将修改它以表示标准的

C ++库,例如, STL。


-

Marcus Kwok



After reading Jonathan''s post, I will amend this to mean the standard
C++ libraries, e.g., the STL.

--
Marcus Kwok


这篇关于C程序是标准的C ++程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆