Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 2.2 - dead code
#2
At first sight, I didn't believe that there was any dead code in your example. However, the question prompted me to re-read Rule 2.2 just to be sure. Having done so, I think you example does contain dead code according to the rule, even though common sense says that it doesn't.

The rule says
Quote:Any operation that is executed but whose removal would not affect program behaviour constitutes dead code

The uint8_t cast seems to satisfy this definition: it is an operator and it is certainly executed but removing it will have no effect on the program's behaviour. If that's the case, then this kind of dead code must be quite common. The essential type rules, for example, may well require insertion of casts that don't actually change the program's behaviour.

Maybe I'm misunderstanding what Rule 2.2 says but I would think that it's not intended to apply to your example.
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)