Implicit type conversions with data loss
Dmitry Olshansky
dmitry.olsh at gmail.com
Tue Jun 5 23:07:04 PDT 2012
On 05.06.2012 22:06, ctrl wrote:
> I don't want them to be performed at all. How do I disable this 'feature'?
>
> For example, take a look at this code:
>
> import std.stdio;
> void main() {
> int x = -1;
> uint b = x;
> writeln(b);
> }
>
> It outputs 4294967295, but I want a compile-time error instead. Any
> suggestions?
> (compiler version dmd 2.059)
There is no information lost. Try casting it back to int.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list