Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#586 different behavior gdl vs. idl for byte assignment to string

v1.0 (example)
closed-out-of-date
nobody
1
2014-02-17
2014-01-20
Brian Carcich
No

GDL behaves differently than IDL in the special case where a byte is assigned to a string via an equals sight.

IDL behavior:

IDL> v=32b

IDL> vs=replicate('',10)

IDL> help,vs[0],vs[1],vs[2]
<Expression> STRING = ''
<Expression> STRING = ''
<Expression> STRING = ''

IDL> vs[1]=v

IDL> help,vs[0],vs[1],vs[2]
<Expression> STRING = ''
<Expression> STRING = ' 32' <==== here is the key
<Expression> STRING = ''

IDL> vs[1]=22L

IDL> help,vs[0],vs[1],vs[2]
<Expression> STRING = ''
<Expression> STRING = ' 22'
<Expression> STRING = ''

GDL behavior:

GDL> v=32b

GDL> vs=replicate('',10)

GDL> vs[1]=v

GDL> help,vs[0],vs[1],vs[2]
<Expression> STRING = ''
<Expression> STRING = ' ' <=== here is the difference
<Expression> STRING = ''

GDL> vs[1]=22L

GDL> help,vs[0],vs[1],vs[2]
<Expression> STRING = ''
<Expression> STRING = ' 22'
<Expression> STRING = ''

N.B. this is what GDL is actually doing:

IDL> vs[1]=string(v)

IDL> help,vs[0],vs[1],vs[2]
<Expression> STRING = ''
<Expression> STRING = ' '
<Expression> STRING = ''

Discussion

  • Brian Carcich
    Brian Carcich
    2014-01-20

    that should be "equals sign" not "equals sight" in the first line.

     
  • Brian Carcich
    Brian Carcich
    2014-01-20

    never mind, that was an older version of GDL

     
  • giloo
    giloo
    2014-02-17

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     GDL behaves differently than IDL in the special case where a byte is assigned to a string via an equals sight.
    
    • status: open --> closed-out-of-date
     
  • giloo
    giloo
    2014-02-17

    ok I close the ticket as out-of-date.