Compile Options

IDL has a couple compile options you can pass it to change the behavior of IDL. Typically you declare compile options at the beginning of a function or procedure and that compile option will be in effect from the declaration of compile_opt until the end of the function. RSI recommends the use of compile_opt IDL2. The usage of this compile option is the equivelent of calling to compile options:

compile_opt DEFINT32, STRICTARR

This has two effects: first if you use an integer constant without specifying it's type, IDL will declare it as a long integer, rather than a short integer. This means that if you forget to add the 'l' to specify a long integer somewhere in your code, it will be a long integer anyway. The strictarr part means that IDL will require you to use brackets '[]' when performing array subscripts and won't allow you to use parenthesis. Although I haven't mentioned this previously IDL will allow users to subscript arrays with parenthesis instead of brackets. This is done for the convenience of fortran programers (fortran uses parenthesis for array subscripting). However using parenthesis for array subscripting can be confusing for both the user and for IDL itself because function declarations also use parenthesis. This can be particularly dangerous in the long term. Imagine if you use parenthesis for array subscripting, and you have an array in one of your programs called qfind. A couple years later IDL releases an update, you install it, and it turns out in this new update there is a built in function called qfind. All of a sudden all your attempts to subscript your array in your programs 'qfind(index)' are now treated as a call to the function qfind(), and your program completely breaks! This horrible occurance can be prevented by either a) using brackets exclusively for array indexing or b) declaring 'compile_opt IDL2' which will require you to use brackets exclusively for array indexing (it will assume that if you use parenthesis you are making a function call, not subscripting a variable).

compile_opt HIDDEN

compile_opt HIDDEN is a simple compile option intended for use in supporting functions and procedures. If you include this in a function or procedure the only result is that IDL won't print out the typical '% Compiled module: FUNCTION_NAME' message when it compiles the function or procedure in question. This way if you call a primary function or procedure to do your work, and that function calls a number of auxillary functions and procedures, you can include this statement in all the auxillary functions and your command line won't be swamped by large numbers of compile messages.