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

v1.0 (example)
closed-out-of-date
nobody
1
2017-03-12
2014-01-20
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.

     
  • Alain C.

    Alain C. - 2017-03-12

    just in case, I add it in a procedure TEST_BYTE_BUG_586 in "test_byte_conversion.pro"
    to prevent any future regression

    A.

     

Log in to post a comment.