March 14, 2005 warning bug - infinite loops | ||||
---|---|---|---|---|
| ||||
The code analyzer doesn't follow returns, issued within the loops: warnloop.d: > int main() > { > for (;;) > return 0; > } warning - warnloop.d(1): function warnloop.main no return at end of function The workaround at the moment is to insert an assertion: > int main() > { > for (;;) > return 0; > assert(0); > } When assertions are skipped over (later on), this becomes: > int main() > { > for (;;) > return 0; > assert(0); > return 0; > } However, at the moment this gives another warning: warning - warnloop.d(6): statement is not reachable --anders |
Copyright © 1999-2021 by the D Language Foundation