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

Home » Public Forums » archive » Re: Problem with ASSOC,/PACKED
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: Problem with ASSOC,/PACKED [message #19221] Thu, 02 March 2000 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Folks,

I wrote yesterday:

> Brian Jackel (bjackel@phys.ucalgary.ca) writes:
>
>> I've run across a bug(?) using ASSOC,/PACKED
>> This appears under v5.3 for Win9x, and v5.2 on
>> SGIs.
>>
>> If anyone has spare time, could you look
>> at the following demonstration script to see if
>> I'm doing anything obviously wrong. Tests
>> on other architectures or versions would also
>> be welcome.
>
> This is the first time I've run across this new
> PACKED keyword, so I really couldn't tell you
> how it works. But on the face of it (and given
> 12+ years reading IDL documentation) this appears
> to be an unfortunate explanation in the documentation.
> I don't have much to go on except a little voice in
> my head that goes, "Naaah, that's not how it works."

Well, my explanation sounded good, but was the
usual nonsense, according to the people who really
know how this works.

It turns out this is a bug in IDL that shows up
when you have structure fields in structures.
The ASSOC function counts the structure as "1",
instead of the number of actual elements in the
sub-structure. The fix has already been placed
in the IDL 5.4 code.

Sorry for any confusion. And my sincerest apologies
to any technical writers whose feelings I may have
bruised. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Problem with ASSOC,/PACKED [message #19244 is a reply to message #19221] Wed, 01 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Brian Jackel (bjackel@phys.ucalgary.ca) writes:

> I've run across a bug(?) using ASSOC,/PACKED
> This appears under v5.3 for Win9x, and v5.2 on
> SGIs.
>
> If anyone has spare time, could you look
> at the following demonstration script to see if
> I'm doing anything obviously wrong. Tests
> on other architectures or versions would also
> be welcome.

This is the first time I've run across this new
PACKED keyword, so I really couldn't tell you
how it works. But on the face of it (and given
12+ years reading IDL documentation) this appears
to be an unfortunate explanation in the documentation.
I don't have much to go on except a little voice in
my head that goes, "Naaah, that's not how it works."

Here is what I think is happening. I think the PACKED
keyword is for reading data structures that have been
packed one byte after the other into a file, rather
than following the normal structure output rules, which
often result in adding bytes here and there to make
fields align with memory boundaries. This kind of
packing may occur, for example, if the user didn't
write the actual structure, but each *field* of the
structure one after the other.

In any case, when IDL *writes* a structure to a file
it *certainly* follows the usual structure rules,
and there will be added bytes here and there. So
the chances of reading a structure written by IDL
back using the PACKED keyword would, I believe,
almost never work with a real structure with
many fields. I think you are proving this conjecture
with your example.

The statement that using PACKED "acts like READU"
sounds like a technical writer translating a concept
he got from an engineer without fully understanding
the implications of that statement to a user.

I'd follow the usual take-what-you-get-with-a-grain-of-salt
rule here. But I would be willing to bet a couple of
bucks I'm pretty close to being right. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: XEmacs for Windows
Next Topic: Re: Newbie Mac PPC shared lib

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

Current Time: Sun Oct 12 02:21:21 PDT 2025

Total time taken to generate the page: 0.40201 seconds