On 08/24/2011 11:55 PM, bearophile wrote:
Timon Gehr:

If anyone is interested:
http://pastebin.com/2rEdx0RD

I suggest you to usually compile your D code with -w, I see some missing overrides. At 
line 40 it gives me a "Warning: statement is not reachable".

There is only one missing override, but it is reported for every instantiation of the template. Statement at line 40 is necessary to make the /type inference/ work out, and such things are the reason I don't usually turn warnings on. Another example where warnings are a pita:

case "bla","blu","blo": // Warning: fallthrough
case "xxx","yyy","zzz":

What the code expresses is: There are two cases, one occurs if the input is bla blu or blo, and the other one if it is xxx or yyy or zzz. Those cases should be handled the same way. (At least for now).
goto case; is both unnecessary and ugly in that case.

So basically, for me there are too many false positives to make the -w switch really practical, which is a pity, as they would have catched the missing override in this case.



Are you able to use it to translate the Haskell version of this task?
http://rosettacode.org/wiki/Hamming_numbers#Haskell


Challenge accepted.

Reply via email to