View mode: basic / threaded / horizontal-split · Log in · Help
July 30, 2012
Detector for unused variables
I wrote a short programm which detect and list unused variables.
I'm sure it isn't perfect but it passed most of my test cases, 
but I think at the moment it isn't good enough to present it in 
announce. Maybe some of you have interest to help me. IMO 
something like this should be integrated into the D compiler.

Comments, suggestions and critism are desirable.

Code: http://dpaste.dzfl.pl/c5f1d2ba
Some of my testcases: http://dpaste.dzfl.pl/f74da85e
July 30, 2012
Re: Detector for unused variables
Namespace:
> I wrote a short programm which detect and list unused variables.

I suggest to attach both code and testcases to:
http://d.puremagic.com/issues/show_bug.cgi?id=3960

Even if your code will never be used, it shows Walter&Andrei that 
there is interest in having this warning, and test cases are 
useful for other implementations too.

Bye,
bearophile
July 30, 2012
Re: Detector for unused variables
On 7/30/12, Namespace <rswhite4@googlemail.com> wrote:
> IMO something like this should be integrated into the D compiler.

As long as it's togglable via a compiler switch. :)
July 30, 2012
Re: Detector for unused variables
On Monday, 30 July 2012 at 16:47:32 UTC, bearophile wrote:
> Namespace:
>> I wrote a short programm which detect and list unused 
>> variables.
>
> I suggest to attach both code and testcases to:
> http://d.puremagic.com/issues/show_bug.cgi?id=3960
>
> Even if your code will never be used, it shows Walter&Andrei 
> that there is interest in having this warning, and test cases 
> are useful for other implementations too.
>
> Bye,
> bearophile

I think my english isn't good enough to make a persuasive comment 
there, but i will try it this evening. I will simply copy my post 
above.

Andrej Mitrovic:
Maybe automatically if you use -w or -wi.
July 30, 2012
Re: Detector for unused variables
Namespace:

> I think my english isn't good enough to make a persuasive 
> comment there, but i will try it this evening. I will simply 
> copy my post above.

Your English skills seems enough, but in the end what's important 
is to show that some people care to have for this warning.
Walter is usually right, but once in a while he's wrong, and some 
stubbornness is needed to show it :)

Bye,
bearophile
July 30, 2012
Re: Detector for unused variables
> I suggest to attach both code and testcases to:
> http://d.puremagic.com/issues/show_bug.cgi?id=3960

Done.
July 30, 2012
Re: Detector for unused variables
Namespace:

>> I suggest to attach both code and testcases to:
>> http://d.puremagic.com/issues/show_bug.cgi?id=3960
>
> Done.

I see no attachments :-( Only ephemeral links.

Bye,
bearophile
July 30, 2012
Re: Detector for unused variables
On Monday, July 30, 2012 18:50:08 Andrej Mitrovic wrote:
> On 7/30/12, Namespace <rswhite4@googlemail.com> wrote:
> > IMO something like this should be integrated into the D compiler.
> 
> As long as it's togglable via a compiler switch. :)

Walter doesn't like compiler switches like that, and he doesn't like it when 
the compiler complains about unused variables. So, I wouldn't expect it to 
happen, but anyone's free to create a pull request and try.

- Jonathan M Davis
July 30, 2012
Re: Detector for unused variables
On 7/30/12, Jonathan M Davis <jmdavisProg@gmx.com> wrote:
> Walter doesn't like compiler switches like that

Walter is a big fat phony, count the number of switches here:
http://www.digitalmars.com/ctg/sc.html#switches

:D
July 30, 2012
Re: Detector for unused variables
On Monday, July 30, 2012 20:08:12 Andrej Mitrovic wrote:
> On 7/30/12, Jonathan M Davis <jmdavisProg@gmx.com> wrote:
> > Walter doesn't like compiler switches like that
> 
> Walter is a big fat phony, count the number of switches here:
> http://www.digitalmars.com/ctg/sc.html#switches

That may be part of _why_ he doesn't like switches for enabling and disabling 
warnings and the like - that and as many switches are there, I'm not sure 
that any actually enable or disable specific warnings - which I believe is 
primarily what he's against.

- Jonathan M Davis
« First   ‹ Prev
1 2 3 4
Top | Discussion index | About this forum | D home