Re: What's new in 2.5?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Sep 08, 2004
- 444 views
On 8 Sep 2004 17:59:51 +0200, Christian Cuvier <Christian.CUVIER at agriculture.gouv.fr> wrote: <snip> >I can remember your reluctant view of preventive action being taken by having >a hook monitor the arglist. And I still believe that. The proposal that exception handling is in general a good programming practice (although common) is usually based on a misunderstanding. If exceptions occur more than once in about 600 times, then it will always be much slower; or of course if the code saving is less than the frame costs, which are often fairly high. There are a few cases where it is better, for example rather than check for an unassigned variable on *every* statement, trap the exception attempting to (eg) read/write address #FFFFFFFC. There is also a case for using a badly written 3rd party library and needing to recover from the exceptions it should not throw. And, of course, you couldn't really write a machine-level debugger without them, least not one you could attach while the program was already running. But in *general*, always prevent errors, not cure them, as you said. >This would help implementing default routine params, for instance. You lost me. Care to elaborate? > >Bottom line: you are right, as long as the handler can resume program >execution. And I'm afraid I read posts in the opposite direction by RC. I've already publicly said RC should concentrate on a simple final exception handler to allow some degree of cleanup before the program terminates (not that I've tried the win32lib thing), before launching into full-blown structured exception handling, which is complicated. Regards, Pete