Andrej Mitrovic wrote: > So I've had a pretty fun bug today when porting some code over to D. > When I port C code to D, first I do a one-to-one translation and make > sure everything works before I try to make use of any D features. > > Here's a function snippet, try to figure out what's wrong with the > code (don't worry about type definitions or external variables yet): > > http://codepad.org/gYNxJ8a5 > > Ok that's quite a bit of code. Let's cut to the chase: > > if (mmioRead(hmmio, cast(LPSTR)&drum, DRUM.sizeof != DRUM.sizeof)) > { > mmioClose(hmmio, 0); > return szErrorCannotRead; > } > [snip.]
Maybe DMD could warn on nonsense of the form x != x. Timon
