www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dmd does not show warnings by casting int to uint

reply Qian Xu <quian.xu stud.tu-ilmenau.de> writes:
Hi All,

I found out that dmd does not show warnings by casting int to uint.

demo code looks as follows:
---------------------------------------------------
module main;
void main()
{
  uint positive = 10;
  int  negative = -1;
  assert(negative < positive); // did not pass
}
---------------------------------------------------

The problem is that the integer "negative" is casted as uint (MAX_UINT)
However, I just wondered, why dmd does not show warnings?


Best regards
Qian
Jul 21 2009
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Qian Xu:
 I found out that dmd does not show warnings by casting int to uint.
I think D2 isn't good enough yet in such regards. If you have good ideas regarding how to improve things, then you may post them in the main D newsgroup. Bye, bearophile
Jul 21 2009
prev sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Qian Xu wrote:
 Hi All,
 
 I found out that dmd does not show warnings by casting int to uint.
<snip> Known bug. http://d.puremagic.com/issues/show_bug.cgi?id=259 Stewart.
Jul 21 2009
parent Qian Xu <quian.xu stud.tu-ilmenau.de> writes:
Stewart Gordon wrote:

 Qian Xu wrote:
 Hi All,
 
 I found out that dmd does not show warnings by casting int to uint.
<snip> Known bug. http://d.puremagic.com/issues/show_bug.cgi?id=259 Stewart.
thanks, good to know that. i thought i have not configured dmd correctly ^^)
Jul 22 2009