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

Home » Public Forums » archive » Re: ASSOC and structures don't mix
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: ASSOC and structures don't mix [message #11096] Sat, 14 March 1998 00:00
mgs is currently offline  mgs
Messages: 144
Registered: March 1995
Senior Member
In article <6eaa68$n0m@ds2.acs.ucalgary.ca>, Brian Jackel
<jackel@danlon.physics.uwo.ca> wrote:

> Recently some people have remarked that ASSOC is a useful
> tool for I/O. While this is true, there is a subtle problem
> when reading structures from a file that was not written
> using ASSOC. The following script demonstrates what I'm
> talking about. Of course, the obvious workaround is to
> write the files using ASSOC as well, but that is not always
> an option.
>
> ;
> ;IDL script to demonstrate why it's dangerous
> ;to use ASSOC with structures.
> ;
...
> ;because IDL is zero padding the structure to
> ;some multiple of 8 bytes (?). There's actually
> ;only 13 bytes (assuming 4 byte floats).
> ;
> HELP,/STR,{PROBLEM}
>
> END

The structure padding got one of my colleagues a couple weeks ago. He had
a structure that should have taken 130 bytes, but was actually taking 136
on his Sun Ultra (64-bit OS) and 132 bytes on my Mac (32-bit OS). I'm not
sure of the exact rules, but basically a structure will be padded to a
multiple of the number of bits of the OS.

--
Mike Schienle Interactive Visuals
mgs@sd.cybernex.net http://ww2.sd.cybernex.net/~mgs/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Question about structure I/O in IDL
Next Topic: Re: zonal means

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

Current Time: Wed Oct 08 20:07:52 PDT 2025

Total time taken to generate the page: 0.01352 seconds