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

Home » Public Forums » archive » Re: Index should be out of range, right?
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: Index should be out of range, right? [message #64517] Wed, 31 December 2008 11:56
T.H. is currently offline  T.H.
Messages: 13
Registered: December 2008
Junior Member
On Dec 31, 2:52 pm, wlandsman <wlands...@gmail.com> wrote:
> On Dec 31, 2:42 pm, "T.H." <timhoagl...@gmail.com> wrote:
>
>> This is confusing because some values of y are greater than the
>> dimensions of the array that they are being used to access and in
>> fact
>
>> IDL> x[y[10],y[10]]=1
>> % Attempt to subscript X with <INT      (      10)> is out of range.
>> % Execution halted at: $MAIN$
>
>> this fails.  Why do I not get an "out of range error" in the first
>> case?
>
> The difference is that in the second example you are subscripting with
> a scalar.    You may want to check out  the "strictarrsubs" option to
> the command compile_opt which I quote below:
>
> "When IDL subscripts one array using another array as the source of
> array indices, the default behavior is to clip any out-of-range
> indices into range and then quietly use the resulting data without
> error. This behavior is described in Array Subscripting. Specifying
> STRICTARRSUBS will instead cause IDL to treat such out-of-range array
> subscripts within the body of the routine containing the COMPILE_OPT
> statement as an error. "

This is close to what I suspected. I appreciate your help.
Re: Index should be out of range, right? [message #64518 is a reply to message #64517] Wed, 31 December 2008 11:52 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Dec 31, 2:42 pm, "T.H." <timhoagl...@gmail.com> wrote:

> This is confusing because some values of y are greater than the
> dimensions of the array that they are being used to access and in
> fact
>
> IDL> x[y[10],y[10]]=1
> % Attempt to subscript X with <INT      (      10)> is out of range.
> % Execution halted at: $MAIN$
>
> this fails.  Why do I not get an "out of range error" in the first
> case?

The difference is that in the second example you are subscripting with
a scalar. You may want to check out the "strictarrsubs" option to
the command compile_opt which I quote below:

"When IDL subscripts one array using another array as the source of
array indices, the default behavior is to clip any out-of-range
indices into range and then quietly use the resulting data without
error. This behavior is described in Array Subscripting. Specifying
STRICTARRSUBS will instead cause IDL to treat such out-of-range array
subscripts within the body of the routine containing the COMPILE_OPT
statement as an error. "
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Index should be out of range, right?
Next Topic: Syntax Sensitive Indenting

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

Current Time: Wed Oct 08 13:53:24 PDT 2025

Total time taken to generate the page: 0.00481 seconds