in reply to Re: Re: Need Unused Variable Warning Msgs
in thread Need Unused Variable Warning Msgs

Parsing C is orders of magnitude simpler than Perl. Not even perl can always pass Perl.

But even if you have such a regex, to actually find out whether a variable is unused or not, you've got to know what a piece of code will do. To determine that at compile time, you need to solve the halting problem.

If you solve the halting problem, I'll do the regex.

Abigail

Replies are listed 'Best First'.
Re: Re: Need Unused Variable Warning Msgs
by samtregar (Abbot) on Jun 10, 2002 at 17:36 UTC
    So how does lint do it? Does it solve the halting problem? I think it would be sufficient to determine if a variable as created in a scope with my() or our() and then never mentioned in the scope again. That would be useful enough to be worth the occaisonal false-positive that would result from evals and other nefarious tricks.

    -sam

      lint doesn't need to solve the halting problem, as C doesn't have any switching between run-time and compile-time.

      Perl does.

      Abigail