DMD compiler - warning of unused variables
jfondren
julian.fondren at gmail.com
Mon Aug 16 14:21:40 UTC 2021
On Monday, 16 August 2021 at 14:14:27 UTC, DLearner wrote:
> Hi
>
> Please see code below:
> ```
> void main() {
>
> import std.stdio;
>
> size_t i;
> size_t j;
>
> i = 5;
>
> writeln("i = ",i);
>
> }
>
> ```
>
> Is there a compiler option that would warn that variable 'j' is
> defined but not used?
>
> Best regards
dmd is anti-warning, so it'd have to be an error, which might be
more annoying than it's worth. `dscanner --report thefile.d`
includes "Variable j is never modified and could have been
declared const or immutable." and "Variable j is never used." as
issues, with line and column numbers.
More information about the Digitalmars-d-learn
mailing list