This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question


Hi Roberto,

C++ is not inherently slower (nor faster) than C.

Keep in mind: bad programs (e.g., slow programs) can be written in any language.

What C++ does is provide language constructs for certain paradigms of programming that C doesn't support in the language itself. Although those programming paradigms CAN be done in C, it's just that the language does not provide any assistance with those programming paradigms as part of the language specification. (Paradigms such as generic programming, object oriented programming, and functional programming.)

Many scientific programs are written procedurally, and C is really good as a procedural programming implementation language. (So is C++, since C++ is mostly a superset of C.)

For scientific programming, the primary language of choice is FORTRAN. (My information may be out of date, but that was the case the last time I checked.)

Other "first choice" languages for scientific programming: Mathematica, C, C++, and Ada.

My own opinion on scientific programming is to go with Mathematica. Dr. Wolfram's "A New Kind of Science" may not pass the sniff test, but his Mathematica is a beautiful tool/language for scientific and pure mathematics purposes.

My next preference is C++ (over C), since I think that object oriented programming and (slightly) stronger typing of C++ can help create correct/complete programs more easily in the scientific arena. If you opt to investigate C++, I recommend adding in the BOOST (www.boost.org) libraries.

HTH,
--Eljay





At 09:11 AM 12/2/2004, Roberto Ausas wrote:
Hi,

My name is Roberto.I am developing a computational code for scientific
calculations and I am using C and gcc to compile my programs. For
different reasons, I have to decide whether to pass to C++ or not, so I
would like to know if C++ programs (e.g. compiled with g++) are slower
than C programs?

Thank you in advance

I look forward to hearing from you soon

Regards

Roberto


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]