|
Archives
D Programming
digitalmars.Ddigitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger D.gnu D C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D - Re: "Unsigned-related bugs never occur in real code."
And abs() of an unsigned number probably needs a compilation warning. Bye, bearophile Jan 21 2010
bearophile wrote:And abs() of an unsigned number probably needs a compilation warning. Jan 21 2010
Don wrote:bearophile wrote:And abs() of an unsigned number probably needs a compilation warning. Jan 21 2010
Don wrote:bearophile wrote:And abs() of an unsigned number probably needs a compilation warning. Jan 21 2010
Rainer Deyke wrote:Don wrote:bearophile wrote:And abs() of an unsigned number probably needs a compilation warning. Jan 21 2010
Andrei Alexandrescu wrote:std.traits has a Unsigned template. I plan to add two functions: signed(x) and unsigned(x), which transform the integral x into the signed/unsigned integral of the same size. Generic code could then call signed or unsigned wherever necessary. For abs, they'd have to call abs(signed(expr)) which I believe clarifies intent and averts bugs like mine. Jan 21 2010
Rainer Deyke wrote:Andrei Alexandrescu wrote:std.traits has a Unsigned template. I plan to add two functions: signed(x) and unsigned(x), which transform the integral x into the signed/unsigned integral of the same size. Generic code could then call signed or unsigned wherever necessary. For abs, they'd have to call abs(signed(expr)) which I believe clarifies intent and averts bugs like mine. Jan 21 2010
|