comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: .compile_opt strictarr is persistent?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: .compile_opt strictarr is persistent? [message #50558] Tue, 10 October 2006 13:38
badjelly.witch is currently offline  badjelly.witch
Messages: 27
Registered: May 2006
Junior Member
Craig Markwardt wrote:
>
> To me, it's kind of dangerous that one module can so drastically
> change the behavior of the system at a global level.

Module? Better clear that concept from the IDL compartment in your
brain.

You haven't been programming in Python, have you?
Re: .compile_opt strictarr is persistent? [message #50566 is a reply to message #50558] Tue, 10 October 2006 00:22 Go to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
David Fanning wrote:
> mgalloy@gmail.com writes:
>
> Indeed, I stumbled onto this in an IDL programming class
> I was teaching. But COMPILE_OPT STRICTARR in an IDL startup
> file does wonders for re-programming the finger/brain
> connections. :-)
>
> Cheers,
>
> David
>
> P.S. Of course, the same thing is true of COMPILE_OPT DEFINT32.
> VERY nice!

I have

compile_opt defint32, strictarr, strictarrsubs, obsolete
!WARN.OBS_ROUTINES

in my idl startup file. Works really well in cleaning up code. Now, if
only there was a command-line switch to make all float constants typed
at teh command line default to double, I'd be really happy.

Maarten
Re: .compile_opt strictarr is persistent? [message #50567 is a reply to message #50566] Mon, 09 October 2006 20:26 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Kenneth P. Bowman" <k-bowman@removethis.tamu.edu> writes:

> In article <1160423178.927770.163510@b28g2000cwb.googlegroups.com>,
> "mgalloy@gmail.com" <mgalloy@gmail.com> wrote:
>
>> I agree -- I have it in my startup file, too. But that's a batch file
>> that I know gets called on startup. Something like this just sitting
>> between routines in a file would be a tough thing to find.
>>
>> Mike
>> --
>> www.michaelgalloy.com
>
> Ah, now I understand. That is ... scary.

To me, it's kind of dangerous that one module can so drastically
change the behavior of the system at a global level.

Good thing there isn't a "compile_opt delete_all_files_upon_exit"
option! :-)

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: .compile_opt strictarr is persistent? [message #50569 is a reply to message #50567] Mon, 09 October 2006 17:15 Go to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <1160423178.927770.163510@b28g2000cwb.googlegroups.com>,
"mgalloy@gmail.com" <mgalloy@gmail.com> wrote:

> I agree -- I have it in my startup file, too. But that's a batch file
> that I know gets called on startup. Something like this just sitting
> between routines in a file would be a tough thing to find.
>
> Mike
> --
> www.michaelgalloy.com

Ah, now I understand. That is ... scary.

Ken
Re: .compile_opt strictarr is persistent? [message #50581 is a reply to message #50569] Mon, 09 October 2006 12:46 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
Kenneth Bowman wrote:
> In article <1160418720.740991.36680@m7g2000cwm.googlegroups.com>,
> "mgalloy@gmail.com" <mgalloy@gmail.com> wrote:
>
>> Follow David's advice as above. I did try this because it seemed odd
>> behavior you were describing. IDL does not complain if you have a
>> compile_opt statement outside of any routine in a file. It will change
>> the behavior of the main-level (but not the routines in the file). I
>> think I will make a list sometime of the most dangerous things IDL will
>> let you do.
>>
>> Mike
>> --
>> www.michaelgalloy.com
>
> I have
>
> COMPILE_OPT IDL2
>
> in my startup.pro.
>
> I thought this was a feature. :-)
>
> (At least the short/long integer part of IDL2).
>
> Ken

I agree -- I have it in my startup file, too. But that's a batch file
that I know gets called on startup. Something like this just sitting
between routines in a file would be a tough thing to find.

Mike
--
www.michaelgalloy.com
Re: .compile_opt strictarr is persistent? [message #50583 is a reply to message #50581] Mon, 09 October 2006 12:32 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <davidf@dfanning.com> writes:

> Craig Markwardt writes:
>
>> Should I put the .compile_opt statement *within* each individual
>> function in the module?
>
> Absolutely. I'm not sure where you are using the
> compile_opt statement (no period in front of it,
> by the way), but if you use it at the IDL main
> level, it is defined at the main level. If you
> want it in effect inside procedures and functions,
> it will have to be declared inside each and every
> procedure or function you want to use it in.

OK, thanks! I made the changes in my local copy and it seems to work
fine.

I'm sort of afraid to convert all of my stuff wholesale to array[]
notation... it's hard to test everything.

Thanks to all the replies!
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: .compile_opt strictarr is persistent? [message #50584 is a reply to message #50583] Mon, 09 October 2006 11:46 Go to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <1160418720.740991.36680@m7g2000cwm.googlegroups.com>,
"mgalloy@gmail.com" <mgalloy@gmail.com> wrote:

> Follow David's advice as above. I did try this because it seemed odd
> behavior you were describing. IDL does not complain if you have a
> compile_opt statement outside of any routine in a file. It will change
> the behavior of the main-level (but not the routines in the file). I
> think I will make a list sometime of the most dangerous things IDL will
> let you do.
>
> Mike
> --
> www.michaelgalloy.com

I have

COMPILE_OPT IDL2

in my startup.pro.

I thought this was a feature. :-)

(At least the short/long integer part of IDL2).

Ken
Re: .compile_opt strictarr is persistent? [message #50586 is a reply to message #50584] Mon, 09 October 2006 11:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mgalloy@gmail.com writes:

> Follow David's advice as above. I did try this because it seemed odd
> behavior you were describing. IDL does not complain if you have a
> compile_opt statement outside of any routine in a file. It will change
> the behavior of the main-level (but not the routines in the file). I
> think I will make a list sometime of the most dangerous things IDL will
> let you do.

Indeed, I stumbled onto this in an IDL programming class
I was teaching. But COMPILE_OPT STRICTARR in an IDL startup
file does wonders for re-programming the finger/brain
connections. :-)

Cheers,

David

P.S. Of course, the same thing is true of COMPILE_OPT DEFINT32.
VERY nice!

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: .compile_opt strictarr is persistent? [message #50587 is a reply to message #50586] Mon, 09 October 2006 11:32 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
David Fanning wrote:
> Craig Markwardt writes:
>
>> Should I put the .compile_opt statement *within* each individual
>> function in the module?
>
> Absolutely. I'm not sure where you are using the
> compile_opt statement (no period in front of it,
> by the way), but if you use it at the IDL main
> level, it is defined at the main level. If you
> want it in effect inside procedures and functions,
> it will have to be declared inside each and every
> procedure or function you want to use it in.
>
> Done this way to ensure backward compatibility, not
> to make your life easier. :-)

Follow David's advice as above. I did try this because it seemed odd
behavior you were describing. IDL does not complain if you have a
compile_opt statement outside of any routine in a file. It will change
the behavior of the main-level (but not the routines in the file). I
think I will make a list sometime of the most dangerous things IDL will
let you do.

Mike
--
www.michaelgalloy.com
Re: .compile_opt strictarr is persistent? [message #50589 is a reply to message #50587] Mon, 09 October 2006 11:00 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Craig Markwardt writes:

> Should I put the .compile_opt statement *within* each individual
> function in the module?

Absolutely. I'm not sure where you are using the
compile_opt statement (no period in front of it,
by the way), but if you use it at the IDL main
level, it is defined at the main level. If you
want it in effect inside procedures and functions,
it will have to be declared inside each and every
procedure or function you want to use it in.

Done this way to ensure backward compatibility, not
to make your life easier. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Low pass filter - Problem with kernel
Next Topic: string functions and arrays

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:39:39 PDT 2025

Total time taken to generate the page: 0.00714 seconds