RE: C vs C++
REMOVE ME FROM ALL EMAIL LISTS ste...@infoprod.com I've tried about a dozen times to stop receiving emails and they just keep coming! Information Products "Experience the Better Way!" 818 986-9295 phone 818 986-7356 fax _ From: luis maldonado [mailto:luis.maldon...@hotmail.com] Sent: Monday, January 19, 2009 7:11 AM To: Palm Developer Forum Subject: RE: C vs C++ Dimitry, Most of us are not as knowlegeable as you are on the inner workings of c and c++ so why don't you gives a small sample of your brilliance on the subject. Why can't C++ be used on the palm os? What differecence does it make where the vtables go? what are the other down sides Ambiguous answers are no help whatsover and WE are looking for help whereever we can... otherwise this forum is just a waster of time, isn't IT? Thanks Dimitry with apologies for wanting more! Luis. > Date: Fri, 16 Jan 2009 11:30:21 -0800 > From: dmitr...@gmail.com > To: palm-dev-forum@news.palmos.com > Subject: Re: C vs C++ > > if off the top of your head you cannot tell me in what segment vtables > are stored in, do not use C++ on Palm - you're not ready for it; if > you can tell me where they are stored, then you should already know > why not to use it for Palm. > > > > > Best Regards, > Dmitry Grinberg > (847) 226 9295 > > > > On Fri, Jan 16, 2009 at 11:18 AM, Kent Loobey wrote: > > Are there any arguments against using C++ for Palm apps when compared > > to C? > > > > > > -- > > For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/ > > > > -- > For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/ _ Windows LiveT HotmailR: Chat. Store. Share. Do more with mail. See how it works. <http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_how itworks_012009> -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/ -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
RE: C vs C++
Thanks Dave for such an AWESOME reply, Dimitry probably had a bad hair day because he's normally pretty good with his helpful answers... anywho, I too have successufuly used C++ and as long as you stick to the rules you have mentioned it's actually pretty good and makes your life easier. I love if for the use of references instead of pointers and have cut down my hard pointer crashes to less than 1% and makes my code more legible Thanks Dave... > From: d...@rudedog.org> To: palm-dev-forum@news.palmos.com> Subject: Re: C vs > C++> Date: Mon, 19 Jan 2009 08:50:36 -0800> > > On Jan 19, 2009, at 7:11 AM, > luis maldonado wrote:> > > Most of us are not as knowlegeable as you are on > the inner workings > > of c and c++ so why don't you gives a small sample of > your > > brilliance on the subject.> >> > Why can't C++ be used on the palm > os?> > I wasn't originally going to respond to Dmitri's answer, because it > > was flippant and added no real insight, but for others' benefit:> > It's > perfectly possible to use C++ successfully for Palm development, > and my > company has successfully delivered many many titles over the > years and all > of them use C++. Some caveats:> > - rtti tends to be a memory hog, so it's > not recommended.> - afaik, exceptions still don't work correctly under > prc-tools/pods.> - the vtables are stored in global memory, so you can't use > C++ > objects with virtual methods unless you have globals.> - overuse of > templates will often fill up the first segment and it's > difficult to map > template functions into a different segment.> > If you follow the above > rules, you'll do fine with C++. Our projects > use an extensive class library > that implements strings, vectors, > auto_ptrs (an an equivalent for > resources), abstract database access, > and a lot of other useful classes.> > > C++ has significantly improved our development cycle; if you're > comfortable > with C++ and OOP you should use it.> > -- > Dave Carrigan> d...@rudedog.org> > Seattle, WA, USA> > > -- > For information on using the ACCESS Developer > Forums, or to unsubscribe, please see > http://www.access-company.com/developers/forums/ _ Windows Live™: E-mail. Chat. Share. Get more ways to connect. http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_allup_howitworks_012009 -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs C++
On Jan 19, 2009, at 7:11 AM, luis maldonado wrote: Most of us are not as knowlegeable as you are on the inner workings of c and c++ so why don't you gives a small sample of your brilliance on the subject. Why can't C++ be used on the palm os? I wasn't originally going to respond to Dmitri's answer, because it was flippant and added no real insight, but for others' benefit: It's perfectly possible to use C++ successfully for Palm development, and my company has successfully delivered many many titles over the years and all of them use C++. Some caveats: - rtti tends to be a memory hog, so it's not recommended. - afaik, exceptions still don't work correctly under prc-tools/pods. - the vtables are stored in global memory, so you can't use C++ objects with virtual methods unless you have globals. - overuse of templates will often fill up the first segment and it's difficult to map template functions into a different segment. If you follow the above rules, you'll do fine with C++. Our projects use an extensive class library that implements strings, vectors, auto_ptrs (an an equivalent for resources), abstract database access, and a lot of other useful classes. C++ has significantly improved our development cycle; if you're comfortable with C++ and OOP you should use it. -- Dave Carrigan d...@rudedog.org Seattle, WA, USA -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
RE: C vs C++
Dimitry, Most of us are not as knowlegeable as you are on the inner workings of c and c++ so why don't you gives a small sample of your brilliance on the subject. Why can't C++ be used on the palm os? What differecence does it make where the vtables go? what are the other down sides Ambiguous answers are no help whatsover and WE are looking for help whereever we can... otherwise this forum is just a waster of time, isn't IT? Thanks Dimitry with apologies for wanting more! Luis. > Date: Fri, 16 Jan 2009 11:30:21 -0800> From: dmitr...@gmail.com> To: > palm-dev-forum@news.palmos.com> Subject: Re: C vs C++> > if off the top of > your head you cannot tell me in what segment vtables> are stored in, do not > use C++ on Palm - you're not ready for it; if> you can tell me where they are > stored, then you should already know> why not to use it for Palm.> > > > > > Best Regards,> Dmitry Grinberg> (847) 226 9295> > > > On Fri, Jan 16, > 2009 at 11:18 AM, Kent Loobey wrote:> > Are there any > arguments against using C++ for Palm apps when compared> > to C?> >> >> > --> > > For information on using the ACCESS Developer Forums, or to unsubscribe, > please see http://www.access-company.com/developers/forums/> >> > -- > For > information on using the ACCESS Developer Forums, or to unsubscribe, please > see http://www.access-company.com/developers/forums/ _ Windows Live™ Hotmail®: Chat. Store. Share. Do more with mail. http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_howitworks_012009 -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
RE: C vs C++
And if C++ is not exotic enough for you, you can always try your hand at C##, and the utter lunacy of JIT compilation. -Original Message- From: Dmitry Grinberg [mailto:dmitr...@gmail.com] Sent: 16 January 2009 19:30 To: Palm Developer Forum Subject: Re: C vs C++ if off the top of your head you cannot tell me in what segment vtables are stored in, do not use C++ on Palm - you're not ready for it; if you can tell me where they are stored, then you should already know why not to use it for Palm. Best Regards, Dmitry Grinberg (847) 226 9295 On Fri, Jan 16, 2009 at 11:18 AM, Kent Loobey wrote: > Are there any arguments against using C++ for Palm apps when compared > to C? > > > -- > For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/ > -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/ -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs C++
if off the top of your head you cannot tell me in what segment vtables are stored in, do not use C++ on Palm - you're not ready for it; if you can tell me where they are stored, then you should already know why not to use it for Palm. Best Regards, Dmitry Grinberg (847) 226 9295 On Fri, Jan 16, 2009 at 11:18 AM, Kent Loobey wrote: > Are there any arguments against using C++ for Palm apps when compared > to C? > > > -- > For information on using the ACCESS Developer Forums, or to unsubscribe, > please see http://www.access-company.com/developers/forums/ > -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
C vs C++
Are there any arguments against using C++ for Palm apps when compared to C? -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
C Vs C++
I have to port a big app from VC++ to Palm OS. The application is a mapping app with lots of map data,routing and so on I am at a juncture where i have to decide between c and c++. If u can give me any link/document/description comparing c and c++ i shall be very gratefull to u. I know that 1. C++ app takes more memory 2 .C++ app is slow on palm Are there any more reasons why we shouldn't go for c++? Thanks in advance Regards, -- Anne Srinivas Software Engineer InfoTech Enterprises Ltd. Plot No 11,Infocity, Software Units Layout, Madhapur,Hyderabad 33 E-Mail : [EMAIL PROTECTED] [EMAIL PROTECTED] Tel (Office) : 3100855 Tel (Resi) : 3033761 -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C Vs C++
> I know that > 1. C++ app takes more memory > 2 .C++ app is slow on palm Hmmm.. Enough said? -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C Vs C++
>> 1. C++ app takes more memory >Only if you use inheritance. Inheritance requires vtables which can take up >some memory. All depends on how many classes and virtual methods you have. Inheritance in itself does not require more memory ! Only virtual methods require vtables and so take more memory and slowdown the program >> 2 .C++ app is slow on palm >C++ is merely a layer above C, which is solved at compile and link time. So >it's not slower than C unless you write classes and methods that slow >everything down. You can use inlines to make your text code look clever and >your machine code be very fast. I'm agree C++ was designed to provide zero-overhead, i.e. you pay for any expensive C++-feature only if you realy use this feature. But we can't know what is the quality of Metrowerks compiler :-( -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C Vs C++
Thanks for all of u for giving u'r valuable suggestions If you have Code Warrior ver 6.0 you can do a simple benchmark. Create 2 projects one in C and another in C++ using a new "Palm OS 3.5 Stationery". Compile and see the sizes of it a C++ dummy app will take 2817bytes and a C app will take 1824bytes. Why is this happening ? Anne Srinivas wrote: > I have to port a big app from VC++ to Palm OS. > The application is a mapping app with lots of map data,routing and so > on > > I am at a juncture where i have to decide between c and c++. > If u can give me any link/document/description comparing c and c++ i > shall be > very gratefull to u. > > I know that > 1. C++ app takes more memory > 2 .C++ app is slow on palm > > Are there any more reasons why we shouldn't go for c++? > > Thanks in advance > > Regards, > -- > Anne Srinivas > Software Engineer > InfoTech Enterprises Ltd. > Plot No 11,Infocity, > Software Units Layout, > Madhapur,Hyderabad 33 > > E-Mail : > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > Tel (Office) : 3100855 > Tel (Resi) : 3033761 -- Anne Srinivas Software Engineer InfoTech Enterprises Ltd. Plot No 11,Infocity, Software Units Layout, Madhapur,Hyderabad 33 E-Mail : [EMAIL PROTECTED] [EMAIL PROTECTED] Tel (Office) : 3100855 Tel (Resi) : 3033761 -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C Vs C++
Kevin O'Keefe wrote: > You guys seem to have missed one of the biggest reasons to question the use > of inheritance on the Palm OS, and this is because the vtables required to > implement inheritance are implemented as global variables and, as such, are > not available under some launch conditions. If it isn't a big loss to not > handle "find" and other "sub-launch" launch codes, then go for it, but if > you need to support these "sub-launches", then the need to carefully decide > what classes can and cannot be implemented as sub-classes because they are > used during "sub-launches" may make it more work than its worth. That's a compiler issue, to some extent. I believe there are versions of the gcc tools out there which seem to handle this a lot more intelligently than other tools. -- Adam Wozniak Senior Software Design Engineer Surveyor Corporation [EMAIL PROTECTED]4548 Broad Street [EMAIL PROTECTED] San Luis Obispo, CA 93401 -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs. C++
In my experience (both on the Palm and in the embedded systems world) it's certainly possible to use C++ and stay almost as efficient as pure C, while gaining a lot of the advantages that C++ provides. I'd suggest approaching it as an embedded system (i.e. firmware) as opposed to a desktop application (i.e. software). Turn off RTTI and exceptions. Avoid multiple inheritance. Keep in mind that virtual functions may be a problem if launched without the globals being initialized. Unrestricted use of new and delete may be a problem, especially on older devices with limited dynamic heap. Used wisely, the overhead can really be reduced to a bare minimum. Take a look at any article on EC++. A good web page to get started at is http://www.dinkumware.com/embed9710.html -- Don Meyer Stormgate Communications -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs. C++
From: "Steve Sabram" <[EMAIL PROTECTED]> > Next time I ever find myself around an academic Computer Science type, I'd > love to see his response to, "So what is the Cost of Implementation of all > this blue sky you are promoting?" Here, Here! I have always been an opponent of the "analysis paralysis" that the object oriented design methods require. I have even encountered a couple of projects recently where the Powers That Be (tm) wanted to take this design approach to a Palm sized application.. I didn't sign on and the projects never saw a line of code before being cancelled. While I'm not proposing the "fly by the seat of the pants" methodology that I taught myself in the mid-80s, this workstation mentality should be left on the workstations and the halls of academia. As for C vs C++ on Palm.. I like the pure C approach for Palm.. it reminds me that I am working on a small, embedded device and that I can't get lazy and program like I have memory and CPU cycles to spare... -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs. C++
Some more tips -- avoid implicit construction. If you pass an object (instead of a reference or a pointer) to a function, then a temporary duplicate of the original object will be constructed and used in the routine. Also, if your function returns an object, you'll be be constructing a temporary to do that job. Less common situation, but also possible: if object A is used where object B required, and there is a constructor for B that takes an A as a parameter, a B will be created automagically. You'd be surprised just how many temporary unnamed objects can be created if you are not watching out for such things. The real overhead in C++ is the "invisible" stuff... -- -Richard M. Hartman [EMAIL PROTECTED] 186,000 mi/sec: not just a good idea, it's the LAW! Stormgate Communications wrote in message <[EMAIL PROTECTED]>... > >In my experience (both on the Palm and in the embedded systems world) it's >certainly possible to use C++ and stay almost as efficient as pure C, >while gaining a lot of the advantages that C++ provides. > >I'd suggest approaching it as an embedded system (i.e. firmware) as >opposed to a desktop application (i.e. software). > >Turn off RTTI and exceptions. Avoid multiple inheritance. Keep in mind >that virtual functions may be a problem if launched without the globals >being initialized. Unrestricted use of new and delete may be a problem, >especially on older devices with limited dynamic heap. > >Used wisely, the overhead can really be reduced to a bare minimum. Take a >look at any article on EC++. A good web page to get started at is >http://www.dinkumware.com/embed9710.html > >-- >Don Meyer >Stormgate Communications > > -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs. C++
Michael Nyrup wrote in message <[EMAIL PROTECTED]>... > >Hi >I´am sorry but I don´t quite understand this, I hope you would care to help >me understand it, as I use objects in my code as often as possible. > >> Less common situation, but also possible: if object A is >> used where object B required, and there is a constructor >> for B that takes an A as a parameter, a B will be created >> automagically. > >Will I automaticlly create an object of B if I create an object of class A >in this eksample? It does´nt make sense to me. > >Sorry if you find this PalmOS off topic. > This illustrates it (not on the Palm...): #include #include class A { public: A() { cout << "A::A()" << endl; } }; class B { public: B() { cout << "B::B()" << endl; } B(const A &a) { cout << "B::B(A&)" << endl; } }; void func(B b) { cout << "func(b)" << endl; } int main(int argc, const char *argv[]) { A a; func(a); return 0; } -- -Richard M. Hartman [EMAIL PROTECTED] 186,000 mi/sec: not just a good idea, it's the LAW! -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs. C++
hi, could you please elaborate more on the problem with virtual functions and the initialization of global variables? it seems that i'm having the same trouble. Stormgate Communications <[EMAIL PROTECTED]> wrote: >In my experience (both on the Palm and in the embedded systems world) it's >certainly possible to use C++ and stay almost as efficient as pure C, >while gaining a lot of the advantages that C++ provides. > >I'd suggest approaching it as an embedded system (i.e. firmware) as >opposed to a desktop application (i.e. software). > >Turn off RTTI and exceptions. Avoid multiple inheritance. Keep in mind >that virtual functions may be a problem if launched without the globals >being initialized. Unrestricted use of new and delete may be a problem, >especially on older devices with limited dynamic heap. > >Used wisely, the overhead can really be reduced to a bare minimum. Take a >look at any article on EC++. A good web page to get started at is >http://www.dinkumware.com/embed9710.html > >-- >Don Meyer >Stormgate Communications > >-- >For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ > > -- Why is College Club the largest and fastest growing college student site? Find out for yourself at http://www.collegeclub.com -- For information on using the ACCESS Developer Forums, or to unsubscribe, please see http://www.access-company.com/developers/forums/
Re: C vs C++
Scalability needed? On a Palm OS device? Yes. On Palm. Scalable in context of one or several dependent projects. I work with linguistic applications with support of tens languages and range of features combined with one single project. Each application has support of number languages and optional features. Is it not scalability of project? It`s needed on Palm as on any another system. -- Alexey Tikhvinsky mailto:[EMAIL PROTECTED] ECTACO, Inc. http://www.ectaco.com http://www.lingvosoft.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: C vs C++
Subject: Re: C vs C++ From: "Alexey Tikhvinsky" <[EMAIL PROTECTED]> Date: Wed, 06 Oct 2004 12:13:06 +0400 On Tue, 5 Oct 2004 19:23:48 -0700, Krzysztof Kowalczyk <[EMAIL PROTECTED]> wrote: > On Wed, 6 Oct 2004 01:40:16 -, Wilson, Mike E. > <[EMAIL PROTECTED]> wrote: >> It is obvious that the new Elipse Development IDE for Palm supports the >> C or C++ language. My question is why is there so little support for >> programming applications in C ++ and if Palm support programming in >> this language why are there no foundation classes or development >> examples, books, etc.? >> >> My limited understanding is C ++ would be more efficent than C, require >> less code, be easier to follow and understand. Someone please expand on >> this for me. > > Your limited understanding isn't entirely correct. C++ is C with added > features. Application written in C++, as compared to C, have more or > less equivalent efficiency and whether they require less code or are > easier to follow and understand depends much more on how well you can > program than on which language you're using. I adamantly diagree! C++ is not C with added features. It`s more complex language with more power and more extencive resources use than C. Main limitation of C++ for palm is extesive memory usage by some language mechanismes such as exception handling and placing VTBL into global data space limited by single 64K section size. Single data segment is not palm limitation. While there are some C++ features which must be used with care, C++ is a better C with a good set of extra, optional capabilities. I'd strongly recommend the use of C++ on Palm OS in most circumstances. Roger Stringer Marietta Systems, Inc. (www.rf-tp.com) -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: C vs C++
"Alexey Tikhvinsky" <[EMAIL PROTECTED]> writes: > And it`s more effective than C, especialy if scalable solution is > needed. Scalability needed? On a Palm OS device? Confused, Jan -- Jan Exner · [EMAIL PROTECTED] · 0x9E0D3E98 · http://www.jan-exner.de/ Neues aus Frankreich und England http://www.jan-exner.de/uk.html -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: C vs C++
On Tue, 5 Oct 2004 19:23:48 -0700, Krzysztof Kowalczyk <[EMAIL PROTECTED]> wrote: On Wed, 6 Oct 2004 01:40:16 -, Wilson, Mike E. <[EMAIL PROTECTED]> wrote: It is obvious that the new Elipse Development IDE for Palm supports the C or C++ language. My question is why is there so little support for programming applications in C ++ and if Palm support programming in this language why are there no foundation classes or development examples, books, etc.? My limited understanding is C ++ would be more efficent than C, require less code, be easier to follow and understand. Someone please expand on this for me. Your limited understanding isn't entirely correct. C++ is C with added features. Application written in C++, as compared to C, have more or less equivalent efficiency and whether they require less code or are easier to follow and understand depends much more on how well you can program than on which language you're using. I adamantly diagree! C++ is not C with added features. It`s more complex language with more power and more extencive resources use than C. Main limitation of C++ for palm is extesive memory usage by some language mechanismes such as exception handling and placing VTBL into global data space limited by single 64K section size. Single data segment is not palm limitation. It`s limitation of compiler. To answer your question, though: historical baggage. Palm OS before OS 6 (i.e. OS in every publicaly available Palm device currently on the market) has very weak support, all Palm OS API was pure C and those 2 facts combined contributed to the fact that no-one really tried to develop C++ wrappers on Palm OS (i.e. foundation classes). Lack of C++ code to document leads to lack of examles and books. Win32 API written on plain C, and what?.. Which is not to say that there aren't any. There is at least one widely known C++ fundation class, POL, shipped with CodeWarrior 9.3. If you're skilled enough, you can also use STL with CodeWarrior 9.3. PODS mostly targets OS 6 which has much better C++ support so the situation might change in the future. However, Palm OS is still in C (for obvious reasons of backward-compatibility) and currently there are no OS 6 devices on the market, so it might not. The point is moot anyway. C is well documented, well supported and good enough to write high-quality applications for Palm. Those are the limitation of Palm OS platform. Accept them, move on and start cranking your code in C. C++ by itself won't save you. Is C well supported in palm?? And how often You are use standart C library (especially with Metrowerks CW)?? Krzysztof Kowalczyk | http://blog.kowalczyk.info If you have enough skills you may write powerful and elegant programs with C++. And it`s more effective than C, especialy if scalable solution is needed. -- Alexey Tikhvinsky mailto:[EMAIL PROTECTED] ECTACO, Inc. http://www.ectaco.com http://www.lingvosoft.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: C vs C++
Krzysztof Kowalczyk wrote: > The point is moot anyway. C is well documented, well supported and good enough to write high-quality applications for Palm. Those are the limitation of Palm OS platform. Accept them, move on and start cranking your code in C. C++ by itself won't save you. I don't agree. You can still use "C++ as a better C" [1]. The real question is whether you use object-oriented or procedural programming. Personally, I use a mixture of both. I have my own set of utility classes for "fundamental" data types such as Vectors, Hashmaps and Strings and I also use classes for most non-visual logic (i.e. data management) in my applications. Constructors and destructors provide natural places for memory (de)allocation. For UI handling I stick to a procedural programming, as all examples and documentation assume this style of programming. (As I'm using PRC Tools I can't use POL.) That all said, a PalmSource-sponsored class framework would be most welcome. Maybe for Cobalt? Regards -Laurens [1] See for example: http://www.glenmccl.com/bett.htm -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: C vs C++
On Wed, 6 Oct 2004 01:40:16 -, Wilson, Mike E. <[EMAIL PROTECTED]> wrote: > It is obvious that the new Elipse Development IDE for Palm supports the C or C++ > language. My question is why is there so little support for programming applications > in C ++ and if Palm support programming in this language why are there no foundation > classes or development examples, books, etc.? > > My limited understanding is C ++ would be more efficent than C, require less code, > be easier to follow and understand. Someone please expand on this for me. Your limited understanding isn't entirely correct. C++ is C with added features. Application written in C++, as compared to C, have more or less equivalent efficiency and whether they require less code or are easier to follow and understand depends much more on how well you can program than on which language you're using. To answer your question, though: historical baggage. Palm OS before OS 6 (i.e. OS in every publicaly available Palm device currently on the market) has very weak support, all Palm OS API was pure C and those 2 facts combined contributed to the fact that no-one really tried to develop C++ wrappers on Palm OS (i.e. foundation classes). Lack of C++ code to document leads to lack of examles and books. Which is not to say that there aren't any. There is at least one widely known C++ fundation class, POL, shipped with CodeWarrior 9.3. If you're skilled enough, you can also use STL with CodeWarrior 9.3. PODS mostly targets OS 6 which has much better C++ support so the situation might change in the future. However, Palm OS is still in C (for obvious reasons of backward-compatibility) and currently there are no OS 6 devices on the market, so it might not. The point is moot anyway. C is well documented, well supported and good enough to write high-quality applications for Palm. Those are the limitation of Palm OS platform. Accept them, move on and start cranking your code in C. C++ by itself won't save you. Krzysztof Kowalczyk | http://blog.kowalczyk.info -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
C vs C++
It is obvious that the new Elipse Development IDE for Palm supports the C or C++ language. My question is why is there so little support for programming applications in C ++ and if Palm support programming in this language why are there no foundation classes or development examples, books, etc.? My limited understanding is C ++ would be more efficent than C, require less code, be easier to follow and understand. Someone please expand on this for me. Regards, Michael W. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
RE: Using C vs C++ to develop apps
Thanks to all who replied.. I appreciate it.. I know is a topic that's been asked many times and i appreciate your time and explainations... My first question to this forum and its been very helpful. R -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
RE: Using C vs C++ to develop apps
You are better off using C++, given a few restrictions that are specific to the Palm runtime model. You can write "in C" but use the C++ compiler for better type checking (just give your files a .cpp extension). Then, as you get comfortable with C++, you can start using some of its' features. -E -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roel Wijmans Sent: Wednesday, July 21, 2004 12:37 AM To: Palm Developer Forum Subject: Re: Using C vs C++ to develop apps I appreciate your reply Keith, I can see some of the issues with C++ but i still would like to hear other developer's opinion on the topic. As i'm not a hugely technical person as i'm just starting out, some of the topics in the FAQ articles don't mean much to me >From those articles it seems C is still favoured over C++. but perhaps people are combining the two? -- 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/
Re: Using C vs C++ to develop apps
Roel Wijmans wrote: I can see some of the issues with C++ but i still would like to hear other developer's opinion on the topic. As i'm not a hugely technical person as i'm just starting out, some of the topics in the FAQ articles don't mean much to me From those articles it seems C is still favoured over C++. but perhaps people are combining the two? Well, I would say that, at the very least, you should use "C++ as a better C". For instance, declaration statements, through which you limit the scope of variables, helps greatly in reducing the likelihood of bugs in your code. I think the real question is whether you choose procedural or object-oriented programming. I use a mixture of both. For my main program logic I stick to procedural programming, but I also wrote several utility classes for "fundamental" data structures such as strings and linked lists. Constructors/destructors provide natural places for memory (de)allocation. Regards -Laurens -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Using C vs C++ to develop apps
Subject: Re: Using C vs C++ to develop apps From: "Roel Wijmans" <[EMAIL PROTECTED]> Date: Wed, 21 Jul 2004 05:37:28 - I can see some of the issues with C++ but i still would like to hear other developer's opinion on the topic. As i'm not a hugely technical person as i'm just starting out, some of the topics in the FAQ articles don't mean much to me From those articles it seems C is still favoured over C++. but perhaps people are combining the two? It is not so much a mixture, it is that on Palm OS you'll see real benefits from using C++ over straight C, but it is best not to go overboard. Roger Stringer Marietta Systems, Inc. (www.mariettasystems.com) -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Using C vs C++ to develop apps
I appreciate your reply Keith, I can see some of the issues with C++ but i still would like to hear other developer's opinion on the topic. As i'm not a hugely technical person as i'm just starting out, some of the topics in the FAQ articles don't mean much to me >From those articles it seems C is still favoured over C++. but perhaps people are >combining the two? -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: Using C vs C++ to develop apps
At 1:38 AM + 7/20/04, Roel Wijmans wrote: This has probably been asked a million times before, but since i can't find much info on this topic, i would appreciate peoples opinion on using ANSI C vs C++. I'm using ANSI C at the moment for my apps, but am noticing a lot of references to C++ and Palm OS development. So what is the best way to go? What are the pros and cons for using C or C++ Since it *has* been asked a million times before, that would make it a "frequently asked" question. :-) There is a FAQ site at: <http://www.flippinbits.com/palmdevfaq> You can check out articles such as the following: <http://flippinbits.com/twiki/bin/view/FAQ/CPlusPlusPitfalls> <http://flippinbits.com/twiki/bin/view/FAQ/ComparingCToCPP> If anyone thinks that those articles don't cover all the issues, the FAQ site is based on a Wiki, so anyone can feel free to add their own information! -- Keith -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Using C vs C++ to develop apps
This has probably been asked a million times before, but since i can't find much info on this topic, i would appreciate peoples opinion on using ANSI C vs C++. I'm using ANSI C at the moment for my apps, but am noticing a lot of references to C++ and Palm OS development. So what is the best way to go? What are the pros and cons for using C or C++ Thanks for your input -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
RE: c Vs C++
Thanks -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mark Chauvin Sent: Tuesday, May 11, 2004 6:49 PM To: Palm Developer Forum Subject: Re: c Vs C++ I'm in the process of rewriting my app from C to C++ using Palm Object Library (POL) that ships with Codewarrior. It's alot easier, I'll tell you that. What takes a page of code in C is about 3 lines in POL. I haven't noticed any difference in performance yet, except for one: updating a grid via the CSimpleGrid object is significantly slower than using native Palm C functions. Easy to work around, though. I just revert back to C for that part. And POL includes some bug fixes/workarounds automatically for annoyances like lists that don't hide/display under older os versions. hth -Mark --- Ritu Chawla <[EMAIL PROTECTED]> wrote: > Hi All, > Can any body please help me by telling what should > be the choice when a > developing a palm applicaiton > c or c++? > gds, > ritu -- 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/
Re: c Vs C++
I'm in the process of rewriting my app from C to C++ using Palm Object Library (POL) that ships with Codewarrior. It's alot easier, I'll tell you that. What takes a page of code in C is about 3 lines in POL. I haven't noticed any difference in performance yet, except for one: updating a grid via the CSimpleGrid object is significantly slower than using native Palm C functions. Easy to work around, though. I just revert back to C for that part. And POL includes some bug fixes/workarounds automatically for annoyances like lists that don't hide/display under older os versions. hth -Mark --- Ritu Chawla <[EMAIL PROTECTED]> wrote: > Hi All, > Can any body please help me by telling what should > be the choice when a > developing a palm applicaiton > c or c++? > gds, > ritu -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
c Vs C++
Hi All, Can any body please help me by telling what should be the choice when a developing a palm applicaiton c or c++? gds, ritu -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
Re: C vs. C++
hi, could you please elaborate more on the problem with virtual functions and the initialization of global variables? it seems that i'm having the same trouble. Stormgate Communications <[EMAIL PROTECTED]> wrote: >In my experience (both on the Palm and in the embedded systems world) it's >certainly possible to use C++ and stay almost as efficient as pure C, >while gaining a lot of the advantages that C++ provides. > >I'd suggest approaching it as an embedded system (i.e. firmware) as >opposed to a desktop application (i.e. software). > >Turn off RTTI and exceptions. Avoid multiple inheritance. Keep in mind >that virtual functions may be a problem if launched without the globals >being initialized. Unrestricted use of new and delete may be a problem, >especially on older devices with limited dynamic heap. > >Used wisely, the overhead can really be reduced to a bare minimum. Take a >look at any article on EC++. A good web page to get started at is >http://www.dinkumware.com/embed9710.html > >-- >Don Meyer >Stormgate Communications > >-- >For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ > > -- Why is College Club the largest and fastest growing college student site? Find out for yourself at http://www.collegeclub.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
"punkraver" <[EMAIL PROTECTED]> wrote: >could you please elaborate more on the problem with virtual functions and >the initialization of global variables? it seems that i'm having the same >trouble. (This is from hazy memory, so someone correct me if I get something wrong) The way that virtual functions work is that the compiler generates a "vtable", which contains a list of pointers-to-functions. One pointer per each virtual function in the class (and it's parents). One vtable per class (not instance of a class, just one per class). Each instance of an object contains a pointer to the vtable for the specific class of the object. So, even if the object instance is created on the stack or the heap (and thus not static), the vtable that it contains a pointer to IS a global static structure, and that's the problem. Since A5 is not set up to point at the application's data area, the vtables can't be found and when we try to run a virtual method --- crash. -- Don Meyer Stormgate Communications -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
on 4/10/00 21:40, Steve Sabram at [EMAIL PROTECTED] wrote: > So true. I have been involved with two ports of C++ code to the PalmOS > where this exact problem (implicit construction) was causing > stack crashes all the time. When one project was complete, I ended up > writing a report that stated that porting the code to the > PalmOS took longer than if we wrote code from scratch and only > referenced the data structures needed that we external to the > project. > > At times, writing platform specific code to complete a project has > created almost a dogmatic conflict over how it should be done. > Some clients are not used to working with a box this small and somehow > they think all computers have infinite memory. So strange... I have a big C++ code base and it compiles and run perfectly on Palm OS (as well as on at least 6 other platforms: WinCE, MacOS, Windows, Linux, Tru64 and Solaris). The app is quite large, not because of C++ but because the code base is big. The only problem we encounter are memory problems, again not because of C++ but because of memory requirements from our application. I think that well thought-out, carefully designed and well written C++ is as good on PalmOS as straight C. The only thing we don't do in C++ is the UI. We do not use RTTI for performance reasons, but do good use of exceptions and it really proved worthwhile. I think there are no arguments against C++ on PalmOS, except for "bad design" (and in some cases, small projects just don't need it). -- Florent Pillet, Software Architect OPTeWAY S.A., 2881 route des crêtes, BP. 308 06906 Sophia Antipolis cedex, FRANCE Phone: +33 4 9295 2613 - Fax: +33 4 9295 2601 - http://www.opteway.com/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
Michael Nyrup wrote in message <26244@palm-dev-forum>... > >Hi >I´am sorry but I don´t quite understand this, I hope you would care to help >me understand it, as I use objects in my code as often as possible. > >> Less common situation, but also possible: if object A is >> used where object B required, and there is a constructor >> for B that takes an A as a parameter, a B will be created >> automagically. > >Will I automaticlly create an object of B if I create an object of class A >in this eksample? It does´nt make sense to me. > >Sorry if you find this PalmOS off topic. > This illustrates it (not on the Palm...): #include #include class A { public: A() { cout << "A::A()" << endl; } }; class B { public: B() { cout << "B::B()" << endl; } B(const A &a) { cout << "B::B(A&)" << endl; } }; void func(B b) { cout << "func(b)" << endl; } int main(int argc, const char *argv[]) { A a; func(a); return 0; } -- -Richard M. Hartman [EMAIL PROTECTED] 186,000 mi/sec: not just a good idea, it's the LAW! -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
Hi I´am sorry but I don´t quite understand this, I hope you would care to help me understand it, as I use objects in my code as often as possible. > Less common situation, but also possible: if object A is > used where object B required, and there is a constructor > for B that takes an A as a parameter, a B will be created > automagically. Will I automaticlly create an object of B if I create an object of class A in this eksample? It does´nt make sense to me. Sorry if you find this PalmOS off topic. Kind regards Michael Nyrup Hornets 'Ten Thumb Postulate' : Experience is directly proportional with the quantity of ruined equipment. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
So true. I have been involved with two ports of C++ code to the PalmOS where this exact problem (implicit construction) was causing stack crashes all the time. When one project was complete, I ended up writing a report that stated that porting the code to the PalmOS took longer than if we wrote code from scratch and only referenced the data structures needed that we external to the project. At times, writing platform specific code to complete a project has created almost a dogmatic conflict over how it should be done. Some clients are not used to working with a box this small and somehow they think all computers have infinite memory. Steve Richard Hartman wrote: > Some more tips -- avoid implicit construction. > > If you pass an object (instead of a reference or a pointer) > to a function, then a temporary duplicate of the original object > will be constructed and used in the routine. > > Also, if your function returns an object, you'll be be > constructing a temporary to do that job. > > Less common situation, but also possible: if object A is > used where object B required, and there is a constructor > for B that takes an A as a parameter, a B will be created > automagically. > > You'd be surprised just how many temporary unnamed > objects can be created if you are not watching out for > such things. > > The real overhead in C++ is the "invisible" stuff... > > -- > -Richard M. Hartman > [EMAIL PROTECTED] > > 186,000 mi/sec: not just a good idea, it's the LAW! > > Stormgate Communications wrote in message <26166@palm-dev-forum>... > > > >In my experience (both on the Palm and in the embedded systems world) it's > >certainly possible to use C++ and stay almost as efficient as pure C, > >while gaining a lot of the advantages that C++ provides. > > > >I'd suggest approaching it as an embedded system (i.e. firmware) as > >opposed to a desktop application (i.e. software). > > > >Turn off RTTI and exceptions. Avoid multiple inheritance. Keep in mind > >that virtual functions may be a problem if launched without the globals > >being initialized. Unrestricted use of new and delete may be a problem, > >especially on older devices with limited dynamic heap. > > > >Used wisely, the overhead can really be reduced to a bare minimum. Take a > >look at any article on EC++. A good web page to get started at is > >http://www.dinkumware.com/embed9710.html > > > >-- > >Don Meyer > >Stormgate Communications > > > > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see >http://www.palmos.com/dev/tech/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
Some more tips -- avoid implicit construction. If you pass an object (instead of a reference or a pointer) to a function, then a temporary duplicate of the original object will be constructed and used in the routine. Also, if your function returns an object, you'll be be constructing a temporary to do that job. Less common situation, but also possible: if object A is used where object B required, and there is a constructor for B that takes an A as a parameter, a B will be created automagically. You'd be surprised just how many temporary unnamed objects can be created if you are not watching out for such things. The real overhead in C++ is the "invisible" stuff... -- -Richard M. Hartman [EMAIL PROTECTED] 186,000 mi/sec: not just a good idea, it's the LAW! Stormgate Communications wrote in message <26166@palm-dev-forum>... > >In my experience (both on the Palm and in the embedded systems world) it's >certainly possible to use C++ and stay almost as efficient as pure C, >while gaining a lot of the advantages that C++ provides. > >I'd suggest approaching it as an embedded system (i.e. firmware) as >opposed to a desktop application (i.e. software). > >Turn off RTTI and exceptions. Avoid multiple inheritance. Keep in mind >that virtual functions may be a problem if launched without the globals >being initialized. Unrestricted use of new and delete may be a problem, >especially on older devices with limited dynamic heap. > >Used wisely, the overhead can really be reduced to a bare minimum. Take a >look at any article on EC++. A good web page to get started at is >http://www.dinkumware.com/embed9710.html > >-- >Don Meyer >Stormgate Communications > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
In my experience (both on the Palm and in the embedded systems world) it's certainly possible to use C++ and stay almost as efficient as pure C, while gaining a lot of the advantages that C++ provides. I'd suggest approaching it as an embedded system (i.e. firmware) as opposed to a desktop application (i.e. software). Turn off RTTI and exceptions. Avoid multiple inheritance. Keep in mind that virtual functions may be a problem if launched without the globals being initialized. Unrestricted use of new and delete may be a problem, especially on older devices with limited dynamic heap. Used wisely, the overhead can really be reduced to a bare minimum. Take a look at any article on EC++. A good web page to get started at is http://www.dinkumware.com/embed9710.html -- Don Meyer Stormgate Communications -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
Hi! > I'll second this recommendation. I have heard this approach been called "Objectless >C++" or "next generation C". My two years of > project development on the PalmOS has been a trend from object implementation to >only using object design. Things like templates, > v-tables and virtual functions have in fact created more of a problem in >upgradability and code maintence on this platform than > avoiding the extra hour needed to implement the same thing without objects. Could you please elaborate on the upgradability/maintenance problems you have encountered with virtual functions? I know I cannot use them when my globals are not available, but are there any other problems? I have recently written my first C++ program for the Palm (I used pure C before) and I am quite satisfied with the results. I used objects mostly to divide my namespace, i.e. they group some functionality, but are singletons and use no inheritance, but in a few circumstances I also used inheritance and polymorphism, and it is all working well so far. I can compile with both Codewarrior and PRC-Tools 2.0. I have written my own version of new/delete to avoid the bad_alloc exception and turned off exception handling and RTTI in the compiler options, which cause a major increase in code size. But now I am at just slightly over 10K for a poor-mans-PowerPoint lookalike that lets fly images and text around on the screen and can play three-channel sound along with it, at amazing speed. I will post the code under the LGPL license as soon as my provider has processed my domain registration. Cheers, Tilo -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: C vs. C++
Coming from the embedded world I find the C code easy to use. The event driven design is giving me a little challenge when I try to treat it as a true embedded processor like the 68HC11. I am finding myself working outside the event loop and asking myself why did they do it this way. Back to the issue the C code is a better approach for my applications where I am creating very small application for specific hardware. I am for keeping it simple. Thank you Rob Cohen -Original Message- From: Bradly J. Barton [SMTP:[EMAIL PROTECTED]] Sent: Monday, October 02, 2000 10:20 PM To: Palm Developer Forum Subject:Re: C vs. C++ From: "Steve Sabram" <[EMAIL PROTECTED]> > Next time I ever find myself around an academic Computer Science type, I'd > love to see his response to, "So what is the Cost of Implementation of all > this blue sky you are promoting?" Here, Here! I have always been an opponent of the "analysis paralysis" that the object oriented design methods require. I have even encountered a couple of projects recently where the Powers That Be (tm) wanted to take this design approach to a Palm sized application.. I didn't sign on and the projects never saw a line of code before being cancelled. While I'm not proposing the "fly by the seat of the pants" methodology that I taught myself in the mid-80s, this workstation mentality should be left on the workstations and the halls of academia. As for C vs C++ on Palm.. I like the pure C approach for Palm.. it reminds me that I am working on a small, embedded device and that I can't get lazy and program like I have memory and CPU cycles to spare... -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
From: "Steve Sabram" <[EMAIL PROTECTED]> > Next time I ever find myself around an academic Computer Science type, I'd > love to see his response to, "So what is the Cost of Implementation of all > this blue sky you are promoting?" Here, Here! I have always been an opponent of the "analysis paralysis" that the object oriented design methods require. I have even encountered a couple of projects recently where the Powers That Be (tm) wanted to take this design approach to a Palm sized application.. I didn't sign on and the projects never saw a line of code before being cancelled. While I'm not proposing the "fly by the seat of the pants" methodology that I taught myself in the mid-80s, this workstation mentality should be left on the workstations and the halls of academia. As for C vs C++ on Palm.. I like the pure C approach for Palm.. it reminds me that I am working on a small, embedded device and that I can't get lazy and program like I have memory and CPU cycles to spare... -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C vs. C++
"Scott Johnson (Bellevue)" wrote: > > From: Laursen,Jacob Lykkeberg XJT [mailto:[EMAIL PROTECTED]] > > Do you guys use C or C++ when coding Palm apps? The API seems C oriented - > > so I'm wondering if there's any real reason to use C++? > > I very strongly recommend at least using the C++ compiler instead of the C > compiler. Take advantage of the "small" features of C++ -- vastly improved > type safety, inline functions, etc. Even just the ability to declare local > variables where needed instead of being forced to put them all at the top of > each function, makes C++ worth using, IMHO. I'll second this recommendation. I have heard this approach been called "Objectless C++" or "next generation C". My two years of project development on the PalmOS has been a trend from object implementation to only using object design. Things like templates, v-tables and virtual functions have in fact created more of a problem in upgradability and code maintence on this platform than avoiding the extra hour needed to implement the same thing without objects. For example, I just handed off a project to new college Computer Science graduate that was in a total spin when I told him not to use any templates or C++ objects in the design. He then went on complaining that the tools are buggy and everything isn't working so he can code the way he was taught. I told him welcome to the new edge and if everything did work well, them someone else was here first instead of you. To really do PalmOS well, you need to know of hardware and have an embedded systems / EE point of view. It is my professional opinion that Java or any other memory / CPU intensive language doesn't mix well on the PalmOS. I mean, all of this very elegant, object design works great when you have a $5000 workstation. When you try to jam this on a $125 dollar device, there is simply not enough resources available to take advantage of it. Next time I ever find myself around an academic Computer Science type, I'd love to see his response to, "So what is the Cost of Implementation of all this blue sky you are promoting?" Steve -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: C vs. C++
> From: Laursen,Jacob Lykkeberg XJT [mailto:[EMAIL PROTECTED]] > Do you guys use C or C++ when coding Palm apps? The API seems C oriented - > so I'm wondering if there's any real reason to use C++? I very strongly recommend at least using the C++ compiler instead of the C compiler. Take advantage of the "small" features of C++ -- vastly improved type safety, inline functions, etc. Even just the ability to declare local variables where needed instead of being forced to put them all at the top of each function, makes C++ worth using, IMHO. As for the "big" features that of C++ like virtual functions (OO design in general), templates, exceptions, STL, etc -- you should first have a good grasp of C++ implementation details and their pros and cons on the Palm system in particular. (Hint: the 'no globals' launch codes can be a big headache.) You'll find plenty of discussion of these things in the list archives. -slj- -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
C vs. C++
Do you guys use C or C++ when coding Palm apps? The API seems C oriented - so I'm wondering if there's any real reason to use C++? -- Jacob Laursen ([EMAIL PROTECTED]) -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: Symbol SDK: C vs. C++
> I tried adding scanner functions to my code and the linker > choked. I played > around with the sample apps and it seems to be that enabling the C++ > compiler causes this behavior. Does anyone have any > suggestions as to what > I could try to do to use the scanner functions in a C++ project? The linker chokes because the Symbol header file are in C (not C++). So with the C++ compiler activated, the C code can be compiled, but it can't be linked together. Add the following wrappers around your Symbol includes: #ifdef __cplusplus extern "C" { #endif ...Symbol header include statements #ifdef __cplusplus } #endif -hkmlt -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: Symbol SDK: C vs C++
If I'm not mistaken the Symbol lib in written in pure C, so if you use this in your C++ program you'll get the name-mangling stuff and your linker will choke. To solve this problem, place the includes between extern "C" calls Rob Mermans Software Engineer Mountside Software Engineering > -Original Message- > From: Martens, Eric A. [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 11, 2000 23:31 > To: Palm Developer Forum > Subject: Symbol SDK: C vs C++ > > > I tried adding scanner functions to my code and the linker > choked. I played > around with the sample apps and it seems to be that enabling the C++ > compiler causes this behavior. Does anyone have any > suggestions as to what > I could try to do to use the scanner functions in a C++ project? > > Thanks, > > Eric Martens > > -- > For information on using the Palm Developer Forums, or to > unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: Recall: Symbol SDK: C vs C++
From: "Martens, Eric A." <[EMAIL PROTECTED]> Subject: Recall: Symbol SDK: C vs C++ > Martens, Eric A. would like to recall the message, "Symbol SDK: C vs C++". Are they fond memories for you? [ Sorry, I couldn't help myself! ;) ] -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Recall: Symbol SDK: C vs. C++
Martens, Eric A. would like to recall the message, "Symbol SDK: C vs. C++". -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Symbol SDK: C vs C++
I tried adding scanner functions to my code and the linker choked. I played around with the sample apps and it seems to be that enabling the C++ compiler causes this behavior. Does anyone have any suggestions as to what I could try to do to use the scanner functions in a C++ project? Thanks, Eric Martens -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Symbol SDK: C vs. C++
I tried adding scanner functions to my code and the linker choked. I played around with the sample apps and it seems to be that enabling the C++ compiler causes this behavior. Does anyone have any suggestions as to what I could try to do to use the scanner functions in a C++ project? Thanks, Eric Martens -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Recall: Symbol SDK: C vs C++
Martens, Eric A. would like to recall the message, "Symbol SDK: C vs C++". -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
Kevin O'Keefe wrote: > You guys seem to have missed one of the biggest reasons to question the use > of inheritance on the Palm OS, and this is because the vtables required to > implement inheritance are implemented as global variables and, as such, are > not available under some launch conditions. If it isn't a big loss to not > handle "find" and other "sub-launch" launch codes, then go for it, but if > you need to support these "sub-launches", then the need to carefully decide > what classes can and cannot be implemented as sub-classes because they are > used during "sub-launches" may make it more work than its worth. That's a compiler issue, to some extent. I believe there are versions of the gcc tools out there which seem to handle this a lot more intelligently than other tools. -- Adam Wozniak Senior Software Design Engineer Surveyor Corporation [EMAIL PROTECTED]4548 Broad Street [EMAIL PROTECTED] San Luis Obispo, CA 93401 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: C Vs C++
You guys seem to have missed one of the biggest reasons to question the use of inheritance on the Palm OS, and this is because the vtables required to implement inheritance are implemented as global variables and, as such, are not available under some launch conditions. If it isn't a big loss to not handle "find" and other "sub-launch" launch codes, then go for it, but if you need to support these "sub-launches", then the need to carefully decide what classes can and cannot be implemented as sub-classes because they are used during "sub-launches" may make it more work than its worth. Kevin > -Original Message- > From: Mr. Somnath Kulkarni [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 31, 2000 10:35 PM > To: Palm Developer Forum > Subject: Re: C Vs C++ > > > Dear srinivas, > I just read your Mail (dated 7/5/00) and i hope U can answer my > question. > > How can I create a pdb file using VC++. > > Waiting for reply. > Bye. > > > -- > For information on using the Palm Developer Forums, or to > unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
Dear srinivas, I just read your Mail (dated 7/5/00) and i hope U can answer my question. How can I create a pdb file using VC++. Waiting for reply. Bye. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
There are two reasons for this difference: * Debugger symbols: Palm programs have the option of embedding the names of the functions that comprise them. The names of the functions appear in memory directly after the functions themselves. Because C++ typically "mangles" functions names (that is, adorns the function names with additional characters that describe the parameter types passed to the function), names generated for C++ functions will be longer. You can negate this differences in two ways: (1) Go into the 68K Process preferences and set Macsbug symbols to "None", or declare all the functions in your application as 'extern "C"'. * Runtime library. For some reason, the runtime startup code included in the two Startup projects is different. One version of __Startup__ comes from StartupCode.c, and the other comes from PalmOS_Startup.c. The latter is more extensive, and is the one used with the C++ project. Replacing the runtime library linked with the C++ project with the one linked with the C project (and making the Macsbug-related changed indicated above) result in both projects producing identical PRC files. -- Keith Rollin -- Palm OS Emulator engineer Anne Srinivas <[EMAIL PROTECTED]> on 07/06/2000 03:22:26 AM Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]> Sent by: Anne Srinivas <[EMAIL PROTECTED]> To: "Palm Developer Forum" <[EMAIL PROTECTED]> cc:(Keith Rollin/US/PALM) Subject: Re: C Vs C++ Thanks for all of u for giving u'r valuable suggestions If you have Code Warrior ver 6.0 you can do a simple benchmark. Create 2 projects one in C and another in C++ using a new "Palm OS 3.5 Stationery". Compile and see the sizes of it a C++ dummy app will take 2817bytes and a C app will take 1824bytes. Why is this happening ? Anne Srinivas wrote: > I have to port a big app from VC++ to Palm OS. > The application is a mapping app with lots of map data,routing and so > on > > I am at a juncture where i have to decide between c and c++. > If u can give me any link/document/description comparing c and c++ i > shall be > very gratefull to u. > > I know that > 1. C++ app takes more memory > 2 .C++ app is slow on palm > > Are there any more reasons why we shouldn't go for c++? > > Thanks in advance > > Regards, > -- > Anne Srinivas > Software Engineer > InfoTech Enterprises Ltd. > Plot No 11,Infocity, > Software Units Layout, > Madhapur,Hyderabad 33 > > E-Mail : > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > Tel (Office) : 3100855 > Tel (Resi) : 3033761 -- Anne Srinivas Software Engineer InfoTech Enterprises Ltd. Plot No 11,Infocity, Software Units Layout, Madhapur,Hyderabad 33 E-Mail : [EMAIL PROTECTED] [EMAIL PROTECTED] Tel (Office) : 3100855 Tel (Resi) : 3033761 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
Thanks for all of u for giving u'r valuable suggestions If you have Code Warrior ver 6.0 you can do a simple benchmark. Create 2 projects one in C and another in C++ using a new "Palm OS 3.5 Stationery". Compile and see the sizes of it a C++ dummy app will take 2817bytes and a C app will take 1824bytes. Why is this happening ? Anne Srinivas wrote: > I have to port a big app from VC++ to Palm OS. > The application is a mapping app with lots of map data,routing and so > on > > I am at a juncture where i have to decide between c and c++. > If u can give me any link/document/description comparing c and c++ i > shall be > very gratefull to u. > > I know that > 1. C++ app takes more memory > 2 .C++ app is slow on palm > > Are there any more reasons why we shouldn't go for c++? > > Thanks in advance > > Regards, > -- > Anne Srinivas > Software Engineer > InfoTech Enterprises Ltd. > Plot No 11,Infocity, > Software Units Layout, > Madhapur,Hyderabad 33 > > E-Mail : > [EMAIL PROTECTED] > [EMAIL PROTECTED] > > Tel (Office) : 3100855 > Tel (Resi) : 3033761 -- Anne Srinivas Software Engineer InfoTech Enterprises Ltd. Plot No 11,Infocity, Software Units Layout, Madhapur,Hyderabad 33 E-Mail : [EMAIL PROTECTED] [EMAIL PROTECTED] Tel (Office) : 3100855 Tel (Resi) : 3033761 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
At 11:55 AM 7/5/00 +0200, Eric Vergnaud wrote: > >I think that the most important thing to consider is: do you need C++ ? That >is, do you need inheritance ? Inheritance is not the only feature of C++. It may even be the most abused one. There are other reasons why you might use C++ such as polymorphism and default arguments. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
>> 1. C++ app takes more memory >Only if you use inheritance. Inheritance requires vtables which can take up >some memory. All depends on how many classes and virtual methods you have. Inheritance in itself does not require more memory ! Only virtual methods require vtables and so take more memory and slowdown the program >> 2 .C++ app is slow on palm >C++ is merely a layer above C, which is solved at compile and link time. So >it's not slower than C unless you write classes and methods that slow >everything down. You can use inlines to make your text code look clever and >your machine code be very fast. I'm agree C++ was designed to provide zero-overhead, i.e. you pay for any expensive C++-feature only if you realy use this feature. But we can't know what is the quality of Metrowerks compiler :-( -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: C Vs C++
I'd have to strongly second that. Yes, it is possible to write bloated, slow programs in C++. It is also possible to write bloated, slow programs in C. In a number of ways, C++ is actually a better system programming language than C. They key is understanding the performance implications of using different language features. This is nothing new. System programmers know the tradeoff of << vs. * in C. They should also know the tradeoff in declaring a member function virtual... Although it is pretty dated, I think that the book Windows++ by Paul DiLascia gives a nice pragmatic introduction to C++. Instead of showing overly trivial sample classes and throwing out a bunch of OOP buzz words it puts a functional wrapper around a (even then) complex OS and gives pretty honest benefit/performance explanations. -jjf -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 05, 2000 2:23 PM To: Palm Developer Forum Subject: Re: C Vs C++ > > I know that > > 1. C++ app takes more memory >> 2 .C++ app is slow on palm > > > Hmmm.. Enough said? Not really, since neither statement is necessarily true. -- Keith -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
on 5/07/00 14:19, HowY at [EMAIL PROTECTED] wrote: >> I know that >> 1. C++ app takes more memory >> 2 .C++ app is slow on palm > > > Hmmm.. Enough said? 1. false (mostly). 2. false. To develop: there are some things in C++ which take more memory, like vtables when using virtual methods. But then, take the difference between a good C++ design and a good C design, look at the ways you solve the problem and you may well end up with eating the same amount of memory. Also, if you don't have zillion of classes, the space used by vtables is close to neglectable. For statement two, this is totally wrong. Bad code can be slow. Bad algorithms can be slow. Good code, good algorithms can be very fast, either in C or C++. I have a rather big code base (for the Palm environment, that is) entirely written in C++ (around 60 classes), not only does it fit on the Palm but it's also quite fast. It's because we tuned the _algorithms_ to be fast, no matter they run in C or C++. That's all the difference. The trick to speed is to know your compiler and processor very well and do some profiling to find the bottlenecks. Metrowerks Profiler is very helpful on that. -- Florent Pillet, Software Architect OPTeWAY S.A., 2881 route des crêtes, BP. 308 06901 Sophia Antipolis cedex, FRANCE Ph: +33 4 93 95 66 51, Fx: +33 4 93 95 66 52, http://www.opteway.com/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
> > I know that > > 1. C++ app takes more memory >> 2 .C++ app is slow on palm > > > Hmmm.. Enough said? Not really, since neither statement is necessarily true. -- Keith -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
> I know that > 1. C++ app takes more memory > 2 .C++ app is slow on palm Hmmm.. Enough said? -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
le 5/07/00 11:04, Tom Zerucha à [EMAIL PROTECTED] a écrit : > On Wed, Jul 05, 2000 at 02:16:07PM +0530, Anne Srinivas wrote: >> I have to port a big app from VC++ to Palm OS. >> The application is a mapping app with lots of map data,routing and so >> on >> >> I am at a juncture where i have to decide between c and c++. >> If u can give me any link/document/description comparing c and c++ i >> shall be >> very gratefull to u. >> >> I know that >> 1. C++ app takes more memory Only if you use inheritance. Inheritance requires vtables which can take up some memory. All depends on how many classes and virtual methods you have. >> 2 .C++ app is slow on palm C++ is merely a layer above C, which is solved at compile and link time. So it's not slower than C unless you write classes and methods that slow everything down. You can use inlines to make your text code look clever and your machine code be very fast. I think that the most important thing to consider is: do you need C++ ? That is, do you need inheritance ? If so then you should use C++ whatever the cost, at least for the objects in your app that require it. Now do you need speed ? Use 68K assembly. Do you need both ? Mix them. Eric VERGNAUD -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
Anne Wrotes > > If u can give me any link/document/description comparing c and c++ Hope this link will have the kinda stuff u asked. http://members.xoom.com/winikoff/palm/dev.html Have fun Prasad N.Bathini AportisTechnologies Corp Software for wearables and carryables visit: http://www.aportis.com eMail: [EMAIL PROTECTED] Work: +91-040-3712235 - Original Message - From: Tom Zerucha <[EMAIL PROTECTED]> To: Palm Developer Forum <[EMAIL PROTECTED]> Sent: Wednesday, July 05, 2000 2:34 PM Subject: Re: C Vs C++ > On Wed, Jul 05, 2000 at 02:16:07PM +0530, Anne Srinivas wrote: > > I have to port a big app from VC++ to Palm OS. > > The application is a mapping app with lots of map data,routing and so > > on > > > > I am at a juncture where i have to decide between c and c++. > > If u can give me any link/document/description comparing c and c++ i > > shall be > > very gratefull to u. > > > > I know that > > 1. C++ app takes more memory > > 2 .C++ app is slow on palm > > > > Are there any more reasons why we shouldn't go for c++? > > Limited stack/heap space. You don't want a lot of hidden constructors > eating resources. You don't quite need to manage things yourself, > Palm's memory management is quite good, but you have to remember to > use DmWrite or do other things like locking blocks and dereferencing > handles. > > In effect, it is not just more memory, but the memory you least would > want to waste, and even so, you will do a lot of things woth memory > "manually" so you lose some of the C++ advantages. > > To clarify, it isn't merely that it is slower/bigger, but that you > can't easily know or control or fix the areas where things create > bloats or bottleneck - all that information hiding has a downside when > you must do optimization. So either you will rip your classes apart > to slim them down (losing the advantages of things like inheritance), > or do other wierd things (move them to a big scratchpad database) > making things harder. > > I don't know how large your original program is, a small, well written > C++ app could work well. But the limits on the Palm are hard limits, > so it *must* fit. > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
Re: C Vs C++
On Wed, Jul 05, 2000 at 02:16:07PM +0530, Anne Srinivas wrote: > I have to port a big app from VC++ to Palm OS. > The application is a mapping app with lots of map data,routing and so > on > > I am at a juncture where i have to decide between c and c++. > If u can give me any link/document/description comparing c and c++ i > shall be > very gratefull to u. > > I know that > 1. C++ app takes more memory > 2 .C++ app is slow on palm > > Are there any more reasons why we shouldn't go for c++? Limited stack/heap space. You don't want a lot of hidden constructors eating resources. You don't quite need to manage things yourself, Palm's memory management is quite good, but you have to remember to use DmWrite or do other things like locking blocks and dereferencing handles. In effect, it is not just more memory, but the memory you least would want to waste, and even so, you will do a lot of things woth memory "manually" so you lose some of the C++ advantages. To clarify, it isn't merely that it is slower/bigger, but that you can't easily know or control or fix the areas where things create bloats or bottleneck - all that information hiding has a downside when you must do optimization. So either you will rip your classes apart to slim them down (losing the advantages of things like inheritance), or do other wierd things (move them to a big scratchpad database) making things harder. I don't know how large your original program is, a small, well written C++ app could work well. But the limits on the Palm are hard limits, so it *must* fit. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
C Vs C++
I have to port a big app from VC++ to Palm OS. The application is a mapping app with lots of map data,routing and so on I am at a juncture where i have to decide between c and c++. If u can give me any link/document/description comparing c and c++ i shall be very gratefull to u. I know that 1. C++ app takes more memory 2 .C++ app is slow on palm Are there any more reasons why we shouldn't go for c++? Thanks in advance Regards, -- Anne Srinivas Software Engineer InfoTech Enterprises Ltd. Plot No 11,Infocity, Software Units Layout, Madhapur,Hyderabad 33 E-Mail : [EMAIL PROTECTED] [EMAIL PROTECTED] Tel (Office) : 3100855 Tel (Resi) : 3033761 -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
RE: C vs C++
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > I would like know if there is any overhead with performance or > memory usage with C++ apps. Not if you know what you are doing. You need to have a good understanding of which C++ features can lead to the so-called "bloat" that non-C++ programmers are so fond of, and generally a good grasp of the implementation of all C++ features. Among other good books, I highly recommend "Inside the C++ Object Model" by Stanley Lippman, from Addison-Wesley. > I like to know about pros/cons of C/C++ apps for palm. The biggest gotcha is that certain launch codes don't let your app access its global variables. This prevents using virtual functions in such launch codes, which may majorly impact your class design. But in the "normal" (GUI) launch codes, you can implement slick virtual-based event handling. > 2) Also are there any sample palm app written in C++ ? Well, there's the so-called C++ stationery that comes with CodeWarrior, but I only mention this to point out that it is _not_ an example of actual useful C++ usage. -slj- -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palm.com/devzone/mailinglists.html
C vs C++
Hello, I am a beginner to palm development, planning to develop apps with CW R6. Mostly this app will be a multi segment app. Now my question is, 1) which is optimal language for palm app development - C or C++? Personaly i would like use C++ b'cos it is reusable, better maintaineneace, i would end up writing less code. But I would like know if there is any overhead with performance or memory usage with C++ apps. I like to know about pros/cons of C/C++ apps for palm. 2) Also are there any sample palm app written in C++ ? thanks, srm -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palm.com/devzone/mailinglists.html