'int' is enough for 'length' to migrate code from x86 to x64
FrankLike via Digitalmars-d
digitalmars-d at puremagic.com
Thu Nov 20 15:37:12 PST 2014
> What about:
>
> uint x;
> auto z = x - 1;
>
> ?
When mixing signed and unsigned, as signed, it maybe no mistaken.
thhere is a small test,add 'cast(long)' before - operator,if it's
auto add,maybe fine.
-----
import std.stdio;
void main()
{
size_t width = 10;
size_t height = 20;
writeln("before width is ",width," ,height is ",height);
height -= 15;
width -= cast(long)height;
writeln("after width is ",width," ,height is ",height);
}
----result: after width is 5 .
it's ok.
Frank
More information about the Digitalmars-d
mailing list