Menu

#628 help message wrong for structures arrays

v1.0 (example)
closed
nobody
None
5
2018-04-16
2014-09-29
giloo
No

GDL> toto=replicate(!D,32)
GDL> help,toto
** Structure !DEVICE, 17 tags, data length=272:
NAME STRING 'X'
X_SIZE LONG 640
Y_SIZE LONG 512
(etc)

IDL> toto=replicate(!D,32)
IDL> help,toto
TOTO STRUCT = -> !DEVICE Array[32]
IDL> help,toto,/str
** Structure !DEVICE, 17 tags, length=88, data length=88:
NAME STRING 'X'
X_SIZE LONG 640
Y_SIZE LONG 512

(etc)

Discussion

  • GregJung

    GregJung - 2014-11-22

    272 indicates this GDL version is aligning entries on 16-byte boundaries.(17 * 16=272). Two of the tags are lonarr(2) so in
    IDL the non-string storage = 14 * 4+16=72 and string is kept in
    a 16-byte slot.

    GDL> str4={ x: 0l, y: lonarr(2), z: 0, aa: 0, bb:0, cc:0}
    GDL> help,/st,str4
    ** Structure <Anonymous>, 6 tags, data length=96:
       X               LONG                 0
       Y               LONG      Array[2]
       Z               INT              0
       AA              INT              0
       BB              INT              0
       CC              INT              0
    GDL> print,16*6
          96
    

    The "data length=" refers to what is allocated in GDL itself,
    probably par->Sizeof() where par->NBytes() is conformant if NBytes is re-defined (post 0.9.5) to be the actual data occupancy rather than Sizeof(). This appears again in the /F77_unformatted mode of writeu and readu which is wrong in versions 0.x thru 0.9.5; when NBytes() is made to count the actual storage, it is corrected.

     

    Last edit: GregJung 2015-03-20
  • Sylwester Arabas

    • status: open --> closed
     

Log in to post a comment.