Hello !
I'm developping an C++ project under Embedded Visual C++ 4.0 for an embedded system with Windows CE 5.0.
By default the exceptions handling is desactivated, we must specify the -GX option in the compiler for activate it.
There is my question :
For an embedded system, the exception handling does increase or decrease the performance of the system
What is better, using exceptions or return integer error values from the functions
Thanks for your answer, and please excuse my English..
Luc

exceptions in EVC++
Wolf5
Hi Luc,
It's likely that you would see a small performance decrease with exception handling enabled, as you will be generating more code and also I believe that native code suffers from having to set exception handlers on each frame, etc. (managed code doesn't have this same issue).
As for what type of error handling is better, that's a religious issue that is hotly debated and there are strong arguments for an against each style. You should look at what sort of code base you have today, and make a decision about whether retrofitting it with exceptions is feasible. Integer error codes may make it easier to spot when someone isn't doing correct error handling, but exceptions may make your code clearer and more understandable, and if used carefully may result in a very good codebase that is easy to maintain.
Ultimately, you should spend some time reading up on the two options. Good books to start with include Herb Sutter's recent books: http://www.amazon.com/gp/product/020170434X/103-4416619-8839026 v=glance&n=283155, http://www.amazon.com/gp/product/0201760428/ref=pd_sim_b_2/103-4416619-8839026 %5Fencoding=UTF8&v=glance&n=283155, http://www.amazon.com/gp/product/0321113586/ref=pd_sim_b_3/103-4416619-8839026 %5Fencoding=UTF8&v=glance&n=283155, and Scott Meyer's http://www.amazon.com/gp/product/0321334876/ref=pd_sim_b_5/103-4416619-8839026 %5Fencoding=UTF8&v=glance&n=283155, http://www.amazon.com/gp/product/020163371X/ref=pd_bxgy_text_b/103-4416619-8839026 %5Fencoding=UTF8.
Hope this gives you something to start with, cheers and happy coding!
Jeff
Amnesiasoft
Hi Jeff !
Thank you very much for your answer. I'll look in this way, thank's for the book reference also, i'm going to look to her.
Bye !
Luc