Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion negative indices, am I missing something here?

Received: by 10.66.78.40 with SMTP id y8mr1239284paw.9.1351895214973;
        Fri, 02 Nov 2012 15:26:54 -0700 (PDT)
Path: s9ni76702pbb.0!nntp.google.com!news.glorb.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From: Michael Galloy <mgal...@gmail.com>
Newsgroups: comp.lang.idl-pvwave
Subject: Re: negative indices, am I missing something here?
Date: Fri, 02 Nov 2012 16:26:57 -0600
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <k71hbe$g4m$1@dont-email.me>
References: <e74c92aa-f0b8-422f-946c-0cd8448a383e@googlegroups.com> <c8580677-3598-40d8-bcd2-89c255024a12@googlegroups.com> <MPG.2afdeec2876c7cbc989722@news.giganews.com>
Mime-Version: 1.0
Injection-Date: Fri, 2 Nov 2012 22:26:54 +0000 (UTC)
Injection-Info: mx04.eternal-september.org; posting-host="0f4d6b02aaac3373159769be8e8db39b";
	logging-data="16534"; mail-complaints-to="ab...@eternal-september.org";	posting-account="U2FsdGVkX1896EkCHHq36E78Q0uAWppl"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20121026 Thunderbird/16.0.2
In-Reply-To: <MPG.2afdeec2876c7cbc989722@news.giganews.com>
Cancel-Lock: sha1:EgQJEVBqrcmZnAXYWERD3bx/GzM=
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 11/2/12 3:53 PM, David Fanning wrote:
> fawltylangu...@gmail.com writes:
>
>> Array subscripts are always clipped. From IDL help:
>>
>> "If an element of the subscript array is less than or equal to zero, the first element of the subscripted array is selected. ...
>>
>> Note: Because of the confusion between the clipping of array subscripts and the use of negative indices (see the next section), it is best to avoid using code that relies on this clipping behavior."
>
> You can think of it as karmic justice for sins of the past. ;-)
>
> Cheers,
>
> David
>
>

Might be a good idea to use

   compile_opt strictarrsubs

to catch these cases.

Mike
-- 
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation