473,667 Members | 2,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2506
On Sun, 31 Aug 2008 17:02:15 -0700, HillBilly <so******@somew here.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 "unreachabl e" means.

Pete
Sep 1 '08 #2

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

Similar topics

3
4013
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 LE\MyProjects\meme\test.java:24: unreachable statement System.out.println(t); ^ 1 error ===================== public class test{
6
4756
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: http://www.dr-wald.de/test/Opera-NOSCRIPT.html Switching off Javascript will show the alternative content. Javascript enabled will only show the JS-content, _not_ the <NOSCRIPT> content.
15
4458
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 application runs flawlessly, but once I call the class from inside a c# windows application the program freezes, crashes etc... there must be a way to make this work inside a windows app as it run great as a command line app.
4
2847
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 this ? C++ exceptions are enabled ( /EHsc ). Thanks. SS
4
6973
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
1714
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
3293
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"); Looks valid to me, but this gives a warning with "new" underlined saying "warning CS0429: Unreachable expression code detected".
4
6169
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; public class Graph { ArrayList<ArrayList<Integer>> graph; public void Graph( int n )
2
2539
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 an if statement with a switch case involved. how ever upon executing, my form dosent calculate the discount due to the warning that says "unreachable code detected". this code i guess is the calculation for my discount with the case declaration....
0
8457
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8365
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8563
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7390
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.