473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Unreachable code detection error

What does that error mean and why would each break statement be marked as
unreachable? It implies the return will --always-- return some --thing-- if
even null and no further processing can possibly be done after the return
statement hence the break statement will not and can ever be reached?

switch (suffix)
{
case 1:
return "<sup>st</sup>";
break;
case 21:
return "<sup>st</sup>";
break;
case 31:
return "<sup>st</sup>";
...
}

Sep 1 '08 #1
1 2491
On Sun, 31 Aug 2008 17:02:15 -0700, HillBilly <so******@somewhere.com>
wrote:
What does that error mean and why would each break statement be marked
as unreachable? It implies the return will --always-- return some
--thing-- if even null and no further processing can possibly be done
after the return statement hence the break statement will not and can
ever be reached?
Yes, that's exactly what it means. How could each "return" statement
return "null" given that in each case you have a string literal? And even
if it could, why would the value it returns affect whether flow can
continue past the "return" statement?

The compiler is correctly telling you that you have "break" statements
that are unreachable. No possible configuration of input could lead to
that code being executed. That's what "unreachable" means.

Pete
Sep 1 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: leza | last post by:
I am trying to understand why "continue" keyword is used for, therefore I compiled this code but I got this error message.. why ==================== C:\Program Files\JCreator...
6
by: Gustav Medler | last post by:
Hello, there is a known problem with Opera and the execution of content shown in <NOSCRIPT> tag. Everythings works fine, if there is only one simple script like:...
15
by: Jim | last post by:
I am extremely frustrated. I am building c# application for a call center and am using a third party API to access some hardware. When develop and test my class using the windows console the...
4
by: SteadySteps | last post by:
Hi I migrated a project which compiles correctly on VC 6.0 to VS 2002. However now all I get several warning that all the statements within catch blocks are "unreachable code". How can I correct...
4
by: Gernot Frisch | last post by:
I get informed that parts of my code cannot be reached. Did I do something wrong? try { if (login(progstring) > 0) { return 1; // OK } }
1
by: tam | last post by:
when i am using session variable i found one error that unreachable core error. how to rectify this error
3
by: Don Burden | last post by:
We've started converting some applications to the .NET 2.0 framework. When compiling in VS 2005, I'm getting a warning on this line: return (unitWidth != null ) ? unitWidth : new Unit("0px"); ...
4
by: EmilyA | last post by:
Hi! I'm not that good at programming, so I was wondering if anyone could tell me why I'm getting an unreachable statement error for lines 18, 35, 68, and 86. import java.util.ArrayList; ...
2
by: selasebytes | last post by:
how do i get over this warning to get my program running correctly?? Below is the faulty part of the code. Am trying to calculate discount on a purchase form. the codes for my discount is nested in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.