DMD compiler - warning of unused variables
russhy
russhy at gmail.com
Mon Aug 16 21:30:41 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
Hi, not compiler, but with dscanner it is possible, in fact with
the code-d vscode extension, you get that out of the box with
visual hints!
Take a look at this screenshot:
https://i.imgur.com/TGkgY3e.png
If you click on the line, it jumps automatically to the right
line, very nice tooling
More information about the Digitalmars-d-learn
mailing list