crocklip
Junior Member level 1
Hi,
I am using PICC compiler for a PIC. I am getting a "unreachable code" warning when I try to return a value given a certain condition in a switch statement.I have included the code below. is this a serious warning? Thanks for the help.
I am using PICC compiler for a PIC. I am getting a "unreachable code" warning when I try to return a value given a certain condition in a switch statement.I have included the code below. is this a serious warning? Thanks for the help.
Code:
int get_value_1(void)
{
unsigned char temp = PORTD;
int valid = 0;
while (PORTD != temp)
{
while (valid == 0)
{
valid = 1;
switch( PORTD )
{
case 0b01101110: return 110;
break;
case 0b01011110: return 116;
break;
case 0b00111110: return 123;
break;
case 0b01101101: return 130;
break;
case 0b01011101: return 138;
break;
case 0b00111101: return 147;
break;
case 0b01101011: return 155;
break;
case 0b01011011: return 165;
break;
case 0b00111011: return 175;
break;
case 0b01100111: return 185;
break;
case 0b01010111: return 196;
break;
case 0b00110111: return 207;
break;
default:
{
valid = 0;
}
} //end of switch
}//end of while
} //end of while
} //end of function