Switch Redundant Assignment

This smell occurs when a redundant assignment is made in a switch statement: for example, assigning a value to a variable in a case block without a following break instruction, then re-assigning another value to the same variable in the subsequent case block.


A. Vetro, L. Ardito, G. Procaccianti, M. Morisio, “Definition, Implementation and Validation of Energy Code Smells: An Exploratory Study on an Embedded System”. ENERGY 2013, pp. 34-39.

Energy Smells


All rights reserved (c) Tushar Sharma 2017-23.