symmetric signed types

Namespace rswhite4 at googlemail.com
Fri Jan 24 16:21:03 PST 2014


On Thursday, 23 January 2014 at 20:35:56 UTC, Andrei Alexandrescu 
wrote:
> On 1/23/14 4:09 AM, Dominikus Dittes Scherkl wrote:
>> There is one mistake in C that D proliverates:
>>
>> The T.min value of signed types.
>>
>> e.g.
>>
>> byte a = -128;
>> auto b = -a;
>>
>> What type should b get? (of course "byte" but the value 
>> doesn't fit!)
>
> The type will be int.
---
import std.stdio;

void main() {
	byte a = -128;
	auto b = -a;
	writeln(typeof(b).stringof);
	writeln(b);
}
----

2.064 output:
byte
-128

Is this a bug or is it already fixed in 2.065?


More information about the Digitalmars-d mailing list