[Issue 10129] problem with short numbers operator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 21 12:42:55 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10129


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |schveiguy at yahoo.com
         Resolution|                            |INVALID


--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> 2013-05-21 12:42:53 PDT ---
The CPU does math at an integer level.  So what happens is, short, ushort,
byte, and ubyte are integer promoted to int, then the operation is performed. 
After the operation, the number may or may not fit into the short, ushort,
byte, or ubyte.  So the compiler requires a cast so you can verify "yes, I know
I'm throwing away data."

This is working as expected.

(In reply to comment #1)
> I am compiling this program, and I don't see errors or warnings:

Right, the report states you have to change Num to byte, ubyte, short, or
ushort.  Probably the attachment should be one of those.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list