I think that we should all remember exactly what C++ is. It's a bunch of
*extensions* to the C language. I use a C++ compiler on Palm, Windows and
everything else, but I don't always write C++. I know that technically there
are some differences between writing C and compiling with a C++ compiler and
just writing in C, but these are basically trivial. At the end of the day,
you can use a C++ compiler to write a bunch of functions in asm and not know
anything about C++ at all. 

Really, this is 2 arguments, one is an argument of degrees, how much OO
design is 'good'? The other is about which compiler to use.

Regarding compilers: I don't know alot about compilers, but I use Code
Warrior for Palm and wrote a bunch of C for a game before I found the C++
button (I think that it's disabled in the trial version that I had before we
paid for it :) I went back and rewrote it in C++ and it was not noticable
bigger or slower. What that says to me is that there's nothing about C++
that makes it slower or bigger, it's just that some compilers have better
C++ support than others, just as some C compilers are better than others.
It's nothing really to do with the language.

Regarding OO: This I know alot more about. C++ has some feaures that can
only be compiled into asm that is slow and/or large, this is a fact. It is
also a fact that these drawbacks are far more serious when coding for Palm
than Windows. However, it is possible to write C code that is just as bad.
The purpose of C++ is to promote OO design, but remember, OO design is a far
older concept than C++ and there is no reason not to use it in a straight C
app. Take a look at the Win32 api, it is a good example of OO design
implemented in C. Whatever language you use, if you decide to use OO you
have to make a comprimise between the best implementation from the
perspective of 'pure OO' design, and what you can implement fast enough,
small enough and in the time available. The comprimise that you strike
between these extremes will depend on your project and your team. Even if
you use a different design system (not OO), this is still a compromise that
you need to make. The 'slower' and 'larger' features of C++ are there to
allow you to easily implement a 'purer' design if you are prepared to pay
the price in speed and size. One thing to remember though, is that to do
*exactly* the same thing as those feaures, you'd have to write the C to do
it. As C++ compiler implementors are generally pretty good at this kind of
thing, use what they provide if you need it, I doubt that many people on
this list can code a vtable lookup routine that is faster than the one that
CW uses.

I'm not really disagreeing with anything that anyone has said, but I think
that it's worth seperating design principles from optimisation and language.
However:

> > that anyone is still using C in this day and age. Even if you don't use
OOP,
> > exceptions, or generic programming, C++ is still an easier and safer
> > language than C.

C++ is far more complex than either C or Java. There are *lots* of gotchas
in it that are dangerous fi you are not aware of them (far more than C or
Java). If you and your team are more comfortable with C and you are more
worried about implementation (speed and size) than design, then there is
really no need to make the move to C++. Remember alot of reliable and
well-designed software has been written in assembler, all compiled languages
are just tools, if you're a good coder than your code will be good in any
language, if you are a bad one than C++ will not save you. 

> hmmm actually I cant think of a single good reason to write in C++ for
> the Palm. I do C++ on Windows but I see no reasons to do so on the Palm.
> C works great. Maybe you can enlighten us...

For the same reasons that you use it on the PC. Unless you're using it on
the PC for bad reasons.

Cheers,
        Idries

-----Original Message-----
From: Aaron Ardiri [mailto:[EMAIL PROTECTED]]
Sent: 03 October 2002 23:30
To: Palm Developer Forum
Subject: Re: C or C++


> > Boy, tell me about it! I can't believe these discussions still come
up--or
> > that anyone is still using C in this day and age. Even if you don't use
OOP,
> > exceptions, or generic programming, C++ is still an easier and safer
> > language than C.
>
> hmmm actually I cant think of a single good reason to write in C++ for
> the Palm. I do C++ on Windows but I see no reasons to do so on the Palm.
> C works great. Maybe you can enlighten us...

oh boy :) flame war beginning :P

i went from C -> Java, and, never bothered with C++ *g* - thats part of
the reason why our apps on the palm are solely in C and asm :P C++ isn't
such a bad language to pick up tho, but, there is a time and a place for
choosing languages, and, limited resource based embedded systems dont
normally end up well with C++ :) it is possible, but, i bet you could
squeeze more with C code than with C++, from both performance and size/
usage requirements.

--
Aaron Ardiri
CEO - CTO
Mobile Wizardry
http://www.mobilewizardry.com/


-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to