Re: Need advice on building a project [message #33406 is a reply to message #33320] |
Fri, 20 December 2002 08:38   |
Pavel A. Romashkin
Messages: 531 Registered: November 2000
|
Senior Member |
|
|
"M. Katz" wrote:
> Could you please say a few words about what these lines accomplish.
>
> Compile_opt, IDL2, hidden
> Error_handler
Compile_opt, IDL2, hidden takes care of the ambiguity that used to
matter when both () and [] were used to subscript arrays. I think I
recall complains about compiling problems and use of the
Forward_Function to avoid them. Setting STRICTRARR or IDL2 as
COMPILE_OPT lets IDL assume that any () indicate a function call, even
if it is not compiled yet.
As far as for Error_Handler, I used it to abbreviate for these lines:
Catch, Err_code ; Provide error handling.
if (Err_code ne 0) then begin
print,'Program error caught:'
help, /last_message
catch, /cancel
return
endif
that I place in (almost) every program (or at least into event handlers)
to provide feedback on any errors that might occur. I think there will
be no feedback in runtime but at least the program won't crash. Often it
is sufficient to handle only event handler errors because any nested
errors will be traced back as well.
Cheers,
Pavel
|
|
|