On 24 Nov 2003, Marco Contenti wrote:
>> ----- 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.
I've considered the problem several times (you're not the first to ask),
and my basic response is: It's a big enough change that I don't want to do
it until after 1.0.
I'm of the inclination that 1.0 should be released when I no longer feel I
have to apologize for anything in Dia. Sure, some things may be nice to
add, but there are things (text rendering in particular) that are just too
shameful to call 1.0. Once they are fixed, 1.0 can come out, and 1.1 might
be an experimental conversion to C++.
The worst problem I see with C++ as such is that it's easy to overuse
features and get unreadable code. But then, using AHOOC is tricky, too.
-Lars
--
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| HĂ„rdgrim of Numenor
"I do not agree with a word that you say, but I |----------------------------
will defend to the death your right to say it." | Where are we going, and
--Evelyn Beatrice Hall paraphrasing Voltaire | what's with the handbasket?