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

Home » Public Forums » archive » Re: Bug? yea or nay.
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: Bug? yea or nay. [message #23737 is a reply to message #23736] Thu, 15 February 2001 14:34 Go to previous messageGo to previous message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Vapuser wrote:
>
> I greatly simplified the structure in question to elucidate the point.
>
> IDL> print,!version
> { mipseb IRIX unix 5.3 Nov 11 1999}
>
> IDL> r={a:0.d, c:0L} & print,n_tags(r,/length),totsize(r)
> 16 12
>

<snip>

> What say you? Bug or not?

From the IDL online manual (I know you already know this, Vapuser. It's here for
completeness):

NTAGS
KEYWORDS
LENGTH

Set this keyword to return the length of the structure, in bytes.

Note - The length of a structure is machine dependent. The length
of a given structure will vary depending upon the host machine.
IDL pads and aligns structures in a manner consistent with the host
machine's C compiler.

This sounds like a similar scenario I have encountered with COMMON blocks in F77 and
structures in F90 (to use or not to use the SEQUENCE statement? :o). If I want to read in
a series of numbers of different types, although my data structure consists of variables
adding up to N bytes, the actual amount of memory used _could_ be more depending on what
system I was on. I always presumed this was done because various OS's were "optimised" to
deal with data (i.e. store, retrieve) lined up on either 8-byte or 4-byte boundaries in
actual memory. The user shouldn't have to worry about the number of bytes (with padding)
in memory (unless you have *humungous* data structures).

I wouldn't consider it a bug, but it does seem rather, uh, lazy to return the _actual_
memory used rather than the sum size of the components when the latter is what is required
to define record sizes to read data - producing side effects such as you have found. I
though the one of the strengths of IDL was its system independence?

Maybe you can sell Kodak/RSI TOTSIZE() for IDL 5.4.1? :o)

BTW, on my linux box with IDL 5.4, print,n_tags(r,/length) = 12

paulv

--
Paul van Delst A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain,
Fax:(301)763-8545 And drinking largely sobers us again.
pvandelst@ncep.noaa.gov Alexander Pope.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Help with reading structure from file
Next Topic: JHU/APL/S1R IDL Library update.

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

Current Time: Fri Oct 10 10:51:21 PDT 2025

Total time taken to generate the page: 0.63790 seconds