Re: 4 byte integers [message #66822] |
Fri, 12 June 2009 16:26  |
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
|
|
|