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

Home » Public Forums » archive » Re: array subscript conversion
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: array subscript conversion [message #55031] Wed, 25 July 2007 11:26 Go to previous message
Foldy Lajos is currently offline  Foldy Lajos
Messages: 268
Registered: October 2001
Senior Member
On Wed, 25 Jul 2007, Dick Jackson wrote:

> Hi,
>
> "FĂ–LDY Lajos" <foldy@rmki.kfki.hu> wrote in message
> news:Pine.LNX.4.64.0707251721430.28405@bifur.rmki.kfki.hu...
>> Hi guys,
>>
>> according to the manual, array subscripts are converted to long (or long64 on
>> 64 bit systems) before use if necessary, so an explicit conversion should not
>> affect the result.
>>
>> IDL> print, !version
>> { x86 linux unix linux 6.3 Mar 23 2006 32 64}
>> IDL>
>> IDL> a=lindgen(10)
>> IDL> print, a[[long(-1ull)]]
>> 0
>> IDL> print, a[[-1ull]]
>> 9
>>
>> Is it a bug or I am missing something?
>
> I think you're expecting -1ull to be negative, but the 'u' in 'ull' means
> 'unsigned'. What you end up with instead of -1 is the largest 64-bit integer
> (this is a nice shortcut when it's actually what you want to do!):
>

No, I have expected LONG(-1ull) to be used for subscripting, which is
really negative. As Mike wrote, integers are not converted to LONG, that
was my wrong assumption.

I am trying to find differences between IDL and FL behavior, and this is
one example. In FL, I always convert non-LONG subscripts to LONG. (It's a
pity we have no formal definition of IDL syntax and semantics.)

regards,
lajos
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: EPS fragment output for latex font interpretation?
Next Topic: Randomize array order

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

Current Time: Fri Oct 10 18:46:46 PDT 2025

Total time taken to generate the page: 0.95943 seconds