if elseif vs. switch


i got impression if else if chains seem produce smaller code switch statements. has explanation why case? curious. have expected switch statements produce shorter code. why other way round?

udo


one way optimize switch statements use jump table.  the typical sequence perform bit of math on switch expression , perform indirect jump using table.

i have no idea if compiler performs optimization but, if does, might explain difference in code size.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > if elseif vs. switch


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums