On Sunday, 22 June 2014 at 11:57:48 UTC, Uranuz wrote:
Another stupid question. Using this logic substraction for two uint values should return int too, because it can produce negative result. Am I right or not?

Now this code

import std.stdio;

void main()
{
        uint a = 50;
        uint b = 60;
        auto c = a - b;

        writeln(typeid(c));
}
produce output "uint". It's some breakage in my logic. I am thinking that all integer-like types should behave similar way. I perceive char type as ubyte, that should be printed as symbol when using functions like writeln(). But the folowing example

import std.stdio;

void main()
{
        ubyte a = 50;
        ubyte b = 60;
        auto c = a - b;

        writeln(typeid(c));
}

produces output "int" like you said. Why there are so complicated rules in the *new* language. It's hard to understand the logic.

Reply via email to