gcc和g ++的C程序之间的性能差异 [英] Performance difference between gcc and g++ for C program

查看:373
本文介绍了gcc和g ++的C程序之间的性能差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说,我必须用C编写的程序,并与GCC和G ++,汇编这将运行得更快编译呢?海湾合作委员会或g ++?我认为G ++编译将使它缓慢,但不知道它。

Lets say i have written a program in C and compiled it with both gcc and g++, which compilation will run faster? gcc or g++? I think g++ compilation will make it slow, but not sure about it.

让我再次澄清,因为有关GCC confutation的我的问题。

Let me clarify my question again because of confutation about gcc.

让我说编译程序交流转换器这样的控制台。

Let say i compile program a.c like this on console.

gcc a.c

g++ a.c

其中的a.out将运行得更快?

which a.out will run faster?

推荐答案

http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/G_002b_002b-and-GCC.html

GCC是一个编译器集合。它主要用于C,C ++,Ada语言,Java的编译和许多编程语言。
G ++是GNU编译器集(GCC)的一部分。结果
我的意思是海湾合作委员会包括G ++为好。当我们使用gcc对C编译++它采用G ++。因为G ++编译器使用它自己的运行时库的输出文件会有所不同。

GCC is a compiler collection. It is mainly used for compilation of C,C++,Ada,Java and many more programming languages. G++ is a part of gnu compiler collection(gcc).
I mean gcc includes g++ as well. When we use gcc for compilation of C++ it uses g++. The output files will be different because the G++ compiler uses its own run time library.

编辑:好吧,澄清的事情,因为我们有一些混乱的命名在这里。 GCC是GNU编译器集合。它可以编译的Ada,C ++,C,和一个十亿半其他语言。这是一个后台像GNAT各种语言的前端的编译器。从去阅读GCC.GNU.Org在页面顶部的我做的链接。

Okay, to clarify things, because we have a bit of confusion in naming here. GCC is the GNU Compiler Collection. It can compile Ada, C++, C, and a billion and a half other languages. It is a "backend" to the various languages "front end" compilers like GNAT. Go read the link i made at the top of the page from GCC.GNU.Org.

GCC也可以指GNU C编译器。这将编译C ++ code如果给-lstdc ++命令,但通常会窒息而死,因为它不是在C ++库拉。

GCC can also refer to the GNU C Compiler. This will compile C++ code if given the -lstdc++ command, but normally will choke and die because it's not pulling in the C++ libraries.

G ++的GNU C ++编译器,如GNU C编译器是一个前端的GNU编译器集合。这是C编译器之间的区别是,它会自动包含这些库并使得其他一些小的调整,因为它是假设它会被馈送C ++ code编译。

G++, the GNU C++ Compiler, like the GNU C Compiler is a front end to the GNU Compiler Collection. It's difference between the C Compiler is that it automatically includes those libraries and makes a few other small tweaks, because it's assuming it's going to be fed C++ code to compile.

这就是混淆的来源。这是否澄清事情有点?

This is where the confusion comes from. Does this clarify things a bit?

这篇关于gcc和g ++的C程序之间的性能差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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