[Issue 259] New: Comparing signed to unsigned does not generate an error

Thomas Kuehne thomas-dloop at kuehne.cn
Sat Aug 26 04:12:56 PDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail at puremagic.com schrieb am 2006-07-20:
> http://d.puremagic.com/issues/show_bug.cgi?id=259

> From the book of Bright,
> http://www.digitalmars.com/d/expression.html#RelExpression
>
> "It is an error to have one operand be signed and the other unsigned for a <,
><=, > or >= expression. Use casts to make both operands signed or both operands
> unsigned."
>
> ...yet...
>
> #import std.conv;
> #int main( char[] args[] ) {
> #       int i = toInt(args[1]);
> #       uint u = toUint(args[2]);
> #       if (i < u)
> #               return 1;
> #       else 
> #               return 0;
> #}
>
> ...compiled with "dmd", "dmd -debug" or "dmd -release" does not give an error
> message, neither at compile time, nor at run time.

Added to DStress as
http://dstress.kuehne.cn/nocompile/o/opCmp_08_A.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_B.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_C.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_D.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_E.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_F.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_G.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_H.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_I.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_J.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_K.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_L.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_M.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_N.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_O.d
http://dstress.kuehne.cn/nocompile/o/opCmp_08_P.d

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFE8DkSLK5blCcjpWoRAvd4AJ9n86OSH7vfqYKSxBQHFupEzG9/OgCfasr1
EMOV+he335iGTfu8g/Ff45g=
=v3rD
-----END PGP SIGNATURE-----



More information about the Digitalmars-d-bugs mailing list