Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

"unreachable code" warning

Status
Not open for further replies.

crocklip

Junior Member level 1
Joined
Nov 23, 2005
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,568
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.



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
 

Hi

Ho it is not - all it says that the software will never reach this line of code

All the best


Bobi
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top