[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Control flow ops, dead code, warnings



Under use warnings we get warnings for useless use in void context.

A somewhat related thing is expressions which involve two
conflicting types of control flow:

	my $value = return "Foo";

	redo && foo();

etc.

Maybe this is worth a warning, since that code can never be reached?


Some edge cases:

Obviously this shouldn't warn:

	return "foo";
	foo(); 

Nor should:

	foo() && redo || bar

But this should:

	redo || bar

as should

	foo() && ( redo || bar() )

So, I think it boils down to an unconditional control op (return,
redo, goto, last, next) in an expression the 'first' of a logop

-- 
  Yuval Kogman <nothingmuch@woobling.org>
http://nothingmuch.woobling.org  0xEBD27418

PGP signature


Follow-Ups from:
"Rafael Garcia-Suarez" <rgarciasuarez@gmail.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]