473,810 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

label not allowed at end of construct?

I'm in the process of trying to create my own lean, mean, uber
linux distro and have bootstrapped a prototype system to build upon.
I'm using the gcc 3.4.3 compiler and am getting an error that I have
to question.

Some of the code I'm compiling places labels at the end of a construct,
either as the destination of a goto or even something as benign as a
default: label in a switch statement.

starting with 3.4.3 (but not before) I'm seeing a compiler error
about not being allowed to place a label directly before the
ending brace of a construct like

label:
}

or

case 'a': break;
default:
}

What's the deal? Whether it is good form or not, I cannot see any
legitimate reason why I would be prohibited from doing this? Is there
a difference in requirements between c and c++ where this is concerned?
should I look for a compiler switch to disable this behavior?
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #1
2 1736
no***@uber.usac hoice.net (Wiseguy) wrote in news:42******** **@127.0.0.1:
I'm in the process of trying to create my own lean, mean, uber
linux distro and have bootstrapped a prototype system to build upon.
I'm using the gcc 3.4.3 compiler and am getting an error that I have
to question.

Some of the code I'm compiling places labels at the end of a
construct, either as the destination of a goto or even something as
benign as a default: label in a switch statement.

starting with 3.4.3 (but not before) I'm seeing a compiler error
about not being allowed to place a label directly before the
ending brace of a construct like

label:
}

or

case 'a': break;
default:
}

What's the deal? Whether it is good form or not, I cannot see any
legitimate reason why I would be prohibited from doing this? Is there
a difference in requirements between c and c++ where this is
concerned? should I look for a compiler switch to disable this
behavior?
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the
World! 120,000+ Newsgroups ----= East and West-Coast Server Farms -
Total Privacy via Encryption =----


A label indicates the next EXECUTABLE statement that control is passed to.
The closing brace of a construct is not an executable statement.

"In C++ (as in C), a label is just a name followed by a colon(:). The
label is placed to the left of a legal C++ statement, and a jump is
accomplished by writing goto followed by the label name."
from 'Sams Teach Yourself C++ in 24 Hours' by Liberty & Horvath.

You could try

{
......
labelname: {}
}

as if the label is attached to an empty statement block.

Is default (in your example) truely a label or part of the switch
construct? I think it is the latter.

Alan
Jul 23 '05 #2
A label needs a statement. Use the null statement:

LAB: ;
}

Jul 23 '05 #3

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

Similar topics

11
17375
by: Neil Zanella | last post by:
Hello, Does anyone know what the following g++ compiler error message means: error: jump to case label I get this error when switching two case labels together with their bodies. I have no setjmp/longjmp or gotos in my program. Thanks,
3
3816
by: Josef K. | last post by:
Asp.net generates the following html when producing RadioButton lists: <td><input id="RadioButtonList_3" type="radio" name="MyRadioButtonList" value="644" onclick="__doPostBack('SitesRadioButtonList_3','')" language="javascript" />
11
5485
by: jcrouse | last post by:
What is the easiest way to do this? I'm creating a layout designer type application Thanks John
31
7248
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
3
2426
by: Neil Wallace | last post by:
Hi, This is an odd one. I've been struggling to get "double click" to work well for my controls. The same event handler works perfectly for buttons, but not for labels. Can anyone tell me why not? Below is an working VB.Net example to illustrate what I mean.
0
2717
by: mkarbarz | last post by:
Hi, I have written a custom dll to collect parameters from a user (for any report definition) and then pass in those parameters to the report viewer (along with datasets and all other necessary things) to render the report. Everything works great, the reports render correctly, however I can't find a way to pass in (value, label) pairs for parameters. In reporting services you can access the the label with...
1
3751
by: bruce628 | last post by:
I want to use SWT Label and popmenu to construct a menubar ,and the effect of this menubar is same to the menubar in SWT.When click the Label,it should be highlighted and popmenu shows.The issue is when click the label and move the mouse to enter next label,the next label can not be highlighted.Can anyone have a solution for it? Here is my code: import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; public class labelmenu { ...
14
13073
by: subramanian100in | last post by:
Consider the following program: #include <iostream> using namespace std; int main() { int i;
5
421
by: Rex Mottram | last post by:
Can anyone explain this? % cat t.c #include <stdio.h> #define FIRST "first" #define SECOND "second" int main(int argc, char *argv)
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10393
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
10124
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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
7664
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
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
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...
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
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.