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

Home » Public Forums » archive » Re: 4 byte integers
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: 4 byte integers [message #66822] Fri, 12 June 2009 16:26 Go to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Jun 12, 5:19 pm, Joshua Von Korff <joshlegan...@hotmail.com> wrote:
> Is there any way I can set a flag to force IDL to consider all
> integers as having 4 bytes?  It's happened many times that I assume a
> number won't go above 32768, and then months later, it does go above.
> This produces an error that can be annoying to track down.  So I've
> taken to writing 0L, 1L, 2L, lindgen() at all times, but sometimes I
> forget.  Any thoughts?
>
> It's not even clear to me that IDL is saving any time by restricting
> to 2 bytes ... aren't they represented as 4 bytes at some lower level
> anyway?

Try "comile_opt defint32" (or "compile_opt idl2" which also throws in
the "strictarr" option which I recommend):

IDL> help, 0
<Expression> INT = 0
IDL> compile_opt defint32
IDL> help, 0
<Expression> LONG = 0

The catch is that it still needs to be done on a routine by routine
basis (there is no "master switch" to throw for this).

Mike
--
www.michaelgalloy.com
Associate Research Scientist
Tech-X Corporation
Re: 4 byte integers [message #66966 is a reply to message #66822] Mon, 15 June 2009 03:10 Go to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
On Jun 13, 1:26 am, Mike Galloy <mgal...@gmail.com> wrote:
> On Jun 12, 5:19 pm, Joshua Von Korff <joshlegan...@hotmail.com> wrote:
>
>> Is there any way I can set a flag to force IDL to consider all
>> integers as having 4 bytes? It's happened many times that I assume a
>> number won't go above 32768, and then months later, it does go above.
>> This produces an error that can be annoying to track down. So I've
>> taken to writing 0L, 1L, 2L, lindgen() at all times, but sometimes I
>> forget. Any thoughts?
>
> Try "comile_opt defint32" (or "compile_opt idl2" which also throws in
> the "strictarr" option which I recommend):

[snip]

> The catch is that it still needs to be done on a routine by routine
> basis (there is no "master switch" to throw for this).

For interactive use, you can put the compile_opt idl2 in your startup
script. This will cover the command-line, but not compiled functions
as Mike already said. I wish there was a master switch, and for float/
double as well.

Maarten
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to visit www.dfanning.com?
Next Topic: yet another idl memory question

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

Current Time: Wed Oct 08 13:59:26 PDT 2025

Total time taken to generate the page: 0.00582 seconds