Re: Silly question about C++
- From: "Marco Contenti" <m contenti libero it>
- To: <dia-list gnome org>
- Subject: Re: Silly question about C++
- Date: Mon, 24 Nov 2003 11:06:21 +0100
----- Original Message -----
From: "Daniele Pighin"
Sent: Saturday, November 22, 2003 11:03 PM
Alle 20:06, sabato 22 novembre 2003, Marco Contenti ha scritto:
Browsing through the Dia code I found lots of objects, methods,
properties,
subclassing... all coded in C.
The first thing I thought is that all this could have been a lot
easier
to
write and maintain, more reliable and efficient if the project started
with
C++.
Is there some basic requirement that prevents using C++?
Please don't tell me that the project started too early. I've been
using
C++ for 13 years.
Cheers.
Marco
Well, I'm not a Dia coder, but:
- Dia uses gtk+, which is written in C;
The same question could appy as well to gtk+. Anyway, you can easily call
C
functions from C++ or, better, write a C++ wrapper around a C library.
- Being (relatively) lower level, C is generally more efficient than
C++;
This seems to be a rather widespread legend. C++ is a superset of C: as
long
as you write C statements, efficiency is exactly the same; C++ constructs
may be more complex, but the compiler generates optimized assembly code
for
them, while this is not the case if you must write the equivalent in C
(say,
function tables vs. virtual functions). I currently develop real-time
software in C++ and have seen device drivers written in C++.
Moreover, IMO, the efficiency of a program depends about 1% on the
compiler
and 99% on the way it's written. Making it more readable makes it easier
to
identify bottlenecks.
- It is generally easier to find a C programmer rather than a C++ one;
Yes, in general, but finding a programmer not messing up such a delicate
construction as pseudo-OO C code is not so easy.
Marco
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]