http://d.puremagic.com/issues/show_bug.cgi?id=10129
Summary: problem with short numbers operator
Product: D
Version: D2
Platform: x86_64
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from cbr <[email protected]> 2013-05-21 12:11:12 PDT ---
Created an attachment (id=1215)
compile error for small number types
I would expect that it is allow to use the operator + and -.
on byte,ubyte,short and ushort numbers by dmd (and gdc) convert those to an
int.
The attach example gives the following complier error.
short_int_test.d(8): Error: cannot implicitly convert expression (cast(int)n +
cast(int)k) of type int to ubyte
When the Num alias is ubyte,byte,ushort and short.
So if we what to use those type we have to cast to an int isn't this a little
overkill.
So instead of
r=n+k;
We have to write.
r=cast(Num)(n+k);
Where r,n,k is the to of Num.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------