Specifying type of Integer Literals
Posted: Tue Apr 29, 2008 4:16 am
There was some discussion a while ago about specifying the type of a fractional literal ( decimal, float) using various suffixes
(see "New Number type and -number:type option" topic)
I thought a logical extension of that would be to allow suffixes for integer literals to specify size and sign so that rather than
this sort of casting redundancy
you could do something 'nicer' like this
Heres a patch that supports int literals with a suffix (i|_i)(8,16,32,64)? or (u|_u)(8,16,32,64).
(see "New Number type and -number:type option" topic)
I thought a logical extension of that would be to allow suffixes for integer literals to specify size and sign so that rather than
this sort of casting redundancy
- Code: Select all
a as int64 = 1000 as int64
l = 73 as int64
you could do something 'nicer' like this
- Code: Select all
a as int64 = 1000_i64
l as int64 = 73_i64
# or more conveniently
l = 73_i64
Heres a patch that supports int literals with a suffix (i|_i)(8,16,32,64)? or (u|_u)(8,16,32,64).