[Issue 13387] Bug with arithmetic opertions on integer types smaller than int
https://issues.dlang.org/show_bug.cgi?id=13387 Basile-z changed: What|Removed |Added CC|b2.t...@gmx.com | --
[Issue 13387] Bug with arithmetic opertions on integer types smaller than int
https://issues.dlang.org/show_bug.cgi?id=13387 Basile-z changed: What|Removed |Added Status|NEW |RESOLVED CC||b2.t...@gmx.com Hardware|x86_64 |All Resolution|--- |WONTFIX OS|Linux |All --- Comment #3 from Basile-z --- There's nothing applicable here, despite of personnal preferences. Implicit conversions and integral promotions rules are specified and this cannot change without creating massive breakages. --
[Issue 13387] Bug with arithmetic opertions on integer types smaller than int
https://issues.dlang.org/show_bug.cgi?id=13387 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|unspecified |D2 --
[Issue 13387] Bug with arithmetic opertions on integer types smaller than int
https://issues.dlang.org/show_bug.cgi?id=13387 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #2 from bearophile_h...@eml.cc --- (In reply to Uranuz from comment #1) So it's strange that we have such type of problem in D. It's a problem introduced on purposes in D. Regarding byte+byte=int it's done like this in D to follow the C rules. I think it's hard to change this. --
[Issue 13387] Bug with arithmetic opertions on integer types smaller than int
https://issues.dlang.org/show_bug.cgi?id=13387 --- Comment #1 from Uranuz neura...@gmail.com --- AFAIK, in C++ the same rules used, but it don't have problems with assignment of type *unsigned short = unsigned short + unsigned short*. So it's strange that we have such type of problem in D. But still integer promotions are used to, although I disagree with it. //- #include iostream #include typeinfo int main() { unsigned short a = 5; unsigned short b = 3; unsigned short c = a + b; //This compiles if( typeid(a + b) == typeid(int) ) { std::cout int std::endl; } else if( typeid(a + b) == typeid(unsigned short) ) { std::cout unsigned short std::endl; } else if( typeid(a + b) == typeid(unsigned int) ) { std::cout unsigned int std::endl; } return 0; } //- This programme outputs: int --