2 ms·
For example, consider: for (i = 0; i < 10; ++i); some C compilers issue a warning for the trailing ; as do some static checkers. If the programmer intende
by WalterBright 7y ago
For example, consider:
for (i = 0; i < 10; ++i);
some C compilers issue a warning for the trailing ; as do some static checkers. If the programmer intended that, the warning is a false negative because the C language rules allow it.
However, such a construct is a hard error in D. Whether you meant it or not, it is not allowed. This is what I meant.
A construct in D that would pass is:
for (i = 0; i < 10; ++i) { }
- int0x80 7y agoThat would be a false positive, if I am understanding things correctly. The warning is about code that is correct, yet it warns, hence false positive. If the warning was missing for incorrect code that would be a false negative. At least that is the terminilogy used for static analysis.