I have had good success using the macros ErrTry-ErrCatch and ErrThrow, defined in the PalmOS headers. There does not appear to be a significant hit to program size. Since they allow you to throw a 32-bit value, I encode the Palm OS error code in the lower 16 bits, the source code line number in the next 12 bits, and the source code file in the upper 4 bits. (Since armlets can't throw exceptions, you don't need to assign a number to their source code files -- so far, I haven't had more than 16 source code files that threw exceptions.)

This nets most of the advantages of exceptions -- simplified error checking. You can't do an exact equivalent to a "finally" clause, but you can catch an exception, do clean up, and throw the exception again from the ErrCatch block.

 I have not, however, tried using them with C++.


On Jul 9, 2008, at 12:14 PM, Michal Seliga wrote:

for even medium size projects i always had to always switch it off because exception tables and such things consume a lot of memory for global variables which is of limited size. because of this you must also be sure you will not use it in launchcodes where globals are not available

if your application is relatively small then you may try it. and if you will hit global variables size limitation you will know its not way to go

my advice - don't use exceptions. better check return codes of functions and make if() whenits needed. it is faster and much simpler to debug in case of problems


--
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to