473,405 Members | 2,167 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,405 software developers and data experts.

sentinel processing, C++ no break label

How do C++ programmers build sentinel, what I'd call an
"error frame" (in this case), stuctures? It's a great
way to parse, error process, and avoid 'if' depth. Since
C++ doesn't have a break/continue LABEL I can't see
anyother way than to use a goto. This is no big deal in
Java or Perl, but C++ guys seem adverse to idea. How would
you do something like this?
status = FAIL;
ERROR_FRAME: for(;;) {

for(...;...;...) {
if(..) {
goto LEAVE_PROGRAM;
}
}

if (bad) {
goto LEAVE_PROGRAM;
}

status = OK;
goto LEAVE_PROGRAM;
}

LEAVE_PROGRAM: return status

Jan 9 '06 #1
1 5337
werwer wrote:
How do C++ programmers build sentinel, what I'd call an
"error frame" (in this case), stuctures? It's a great
way to parse, error process, and avoid 'if' depth. Since
C++ doesn't have a break/continue LABEL I can't see
anyother way than to use a goto. This is no big deal in
Java or Perl, but C++ guys seem adverse to idea. How would
you do something like this?
status = FAIL;
ERROR_FRAME: for(;;) {

for(...;...;...) {
if(..) {
goto LEAVE_PROGRAM;
}
}

if (bad) {
goto LEAVE_PROGRAM;
}

status = OK;
goto LEAVE_PROGRAM;
}

LEAVE_PROGRAM: return status


read up on try/throw/catch

Larry
Jan 9 '06 #2

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

Similar topics

3
by: d.j. | last post by:
This program will not let me use the charater as the sentinel please advise... The error I get is can not convert char to char* # include <iostream.h> int main() { char stname ; //student...
3
by: Mike | last post by:
I am writing this program that first asks the user to type today's exchange rate between U.S. dollars and Japanese yen, then reads U.S. dollar value and converts each. I am attemtping to use 0 or...
25
by: chunhui_true | last post by:
In <<expert c>>I know the break in if wich is scoped in switch is break the switch,like: switch c case 1: if(b){ break; } ...... But like this: while(a){
13
by: shan | last post by:
Hi to everybody here is my simple doubt What is meant by sentinel control loops ?
7
by: Ben Finney | last post by:
Howdy all, Ned Batchelder blogged about a debate over checking function parameters, and to what extent dynamic typing should be relied upon. I was one of many who commented, but I wrote what...
5
by: B. Williams | last post by:
I need some assistance with random access file processing. I have a function that I would like to change from sequential file processing to random access. Thanks in advance. void...
26
by: Alexander Korsunsky | last post by:
Hi! I have some code that looks similar to this: -------------------------------------------- char array = "abcdefghij"; for (int i = 0; i < 10; i++) {
2
by: YASIN786 | last post by:
hi all i am helping a friend to develop a java program to implement the following features but i cannot understand how to go about this problem. A text file contains a number of English...
8
numberwhun
by: numberwhun | last post by:
Hello everyone! I am dabbling in processing forms using Perl and having only just begun, I am already having problems. Go figure. :-) Top begin with, here it the form's html, its nothing at...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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:
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,...
0
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...

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.