473,790 Members | 3,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

try-catch name

Hi,

I cannot believe my eyes, but so far I could not find out what is the name
of the construct, which is built from one try block and the catch clauses
(handlers). I am not looking for a grammar name, but something people can
remember, like handler. But is not handler, because those are the catch
clauses and the try does not belong there. I have looked at all my books
and the standard, but I could not find a name. :-(

Is there anyone who knows that name? If there is, please share it with me
here. :-)

--
WW aka Attila
:::
RTFM: Not just an acronym, it's the LAW!
Jul 23 '05
19 2572
Alf P. Steinbach wrote:
* White Wolf:
GB wrote:
GB wrote:

I think actually the standard calls the whole construct an exception
handler, which consists of a try clause and one or more catch clauses.

For example, in section 1.3.9, it refers to the "catch clause of an
exception handler".
Thank you for the help!

I think that the confusion is then complete. :-) C++ Primer excusively
calls the catch clauses handlers, and so does the grammar. So I guess I
have to call it try-catch or try&catch until a better name comes along.
I would just allow room for ambiguity with either (otherwise good)
name. :-(


How about "try-catch statement"?


I will probably use that where it fits (I admit I make slides ;-)).
Just ignore the darned standard, it's very non-standard (heh) in its
terminology...


:-) When I will be in the position that enables me to create C++ technical
terminology, I will certainly do that. Until then, I should stick with what
serves my target audience best.

--
WW aka Attila
:::
How come I can never find Troi when I'm mad at her?
Jul 23 '05 #11
GB wrote:
[SNIP]
I see I was mistaken when I said that the grammar treats the try part
alone as a statement. The grammar uses the term try-block to refer to
the whole construct, including the catch clauses, not just the try part.
However, both the standard and Stroustrup's book use the term "try
block" to refer to the try part alone. For example, at the end of page
187, he says "If any code in a try block - or called from it - throws an
exception, the try block's handlers will be examined." However, this is
not literally true if the exception handlers themselves are considered
part of the try block.


Yep, there seems to be a bit of confusion around the terminology. :-(

--
WW aka Attila
:::
Whoever said nothing is impossible never tried slamming a revolving door.
Jul 23 '05 #12
GB wrote:

It's called a try statement.


Actually the terminonlogy in the standard is "try-block"
(which is a statement).
Jul 23 '05 #13
Ron Natalie wrote:
GB wrote:

It's called a try statement.


Actually the terminonlogy in the standard is "try-block"
(which is a statement).


As far as I saw that only covers the try part, but not the handlers. At
least according to the grammar part, and according to C++ Primer 3rd
edition.

--
WW aka Attila
:::
It is far more impressive when others discover your good qualities without
your help.
Jul 23 '05 #14
White Wolf wrote:
Ron Natalie wrote:
GB wrote:

It's called a try statement.


Actually the terminonlogy in the standard is "try-block"
(which is a statement).

As far as I saw that only covers the try part, but not the handlers. At
least according to the grammar part, and according to C++ Primer 3rd
edition.

Nope, it covers everything. try-block is "try compound-statement handler-seq".
Jul 23 '05 #15
Ron Natalie wrote:
White Wolf wrote:
Ron Natalie wrote:
GB wrote:
It's called a try statement.

Actually the terminonlogy in the standard is "try-block"
(which is a statement).

As far as I saw that only covers the try part, but not the handlers. At
least according to the grammar part, and according to C++ Primer 3rd
edition.

Nope, it covers everything. try-block is "try compound-statement
handler-seq".


Right. How did I miss that one? In this case I just hope C++ Primer 4th
edition has actually fixed the misuse of the term. Since in their
"free-to-access" chapter 11 it says:

'A try block introduces a local scope, and variables declared within a try
block cannot be referred to outside the try block, including within the
catch clauses.'

I mean that makes it pretty clear that the author(s) did not count the
handlers into the try block. I just wonder how did I manage to
misunderstand the standard. Maybe it was the tiredness.

Thanks Ron!

--
WW aka Attila
:::
If at first you don't succeed, failure may be your style.
Jul 23 '05 #16
exceptions ?

"White Wolf" <wo***@freemail .hu> wrote in message
news:cv******** **@phys-news1.kolumbus. fi...
Hi,

I cannot believe my eyes, but so far I could not find out what is the name
of the construct, which is built from one try block and the catch clauses
(handlers). I am not looking for a grammar name, but something people can
remember, like handler. But is not handler, because those are the catch
clauses and the try does not belong there. I have looked at all my books
and the standard, but I could not find a name. :-(

Is there anyone who knows that name? If there is, please share it with me
here. :-)

--
WW aka Attila
:::
RTFM: Not just an acronym, it's the LAW!

Jul 23 '05 #17
"White Wolf" <wo***@freemail .hu> wrote in message
news:cv******** **@phys-news1.kolumbus. fi...
I cannot believe my eyes, but so far I could not find out what is the name
of the construct, which is built from one try block and the catch clauses
(handlers). I am not looking for a grammar name, but something people can
remember, like handler. But is not handler, because those are the catch
clauses and the try does not belong there. I have looked at all my books
and the standard, but I could not find a name. :-(

Is there anyone who knows that name? If there is, please share it with me
here. :-)


The C++ standard uses the term "try-block" to refer to the entire statement,
including all handlers, and does not appear to have a separate name for the
compound statement that appears between "try" and the first "catch."

I had to look at the standard to find this out. Left to my own devices, I
would have used "try statement" to refer to the entire statement and
"subject of the try statement" to refer to the compound statement between
"try" and "catch."
Jul 23 '05 #18

Andrew Koenig wrote:
[...]
I had to look at the standard to find this out. Left to my own devices, I
would have used "try statement" to refer to the entire statement and
"subject of the try statement" to refer to the compound statement between
"try" and "catch."


Nah, in the case of function-try-block, "try-body" consists from
ctor-initializer (opt) and function-body (compound-statement).

And {function-}try-block's handler-seq is nothing but one or more
legs supporting the body, oder? ;-)

regards,
alexander.
Jul 23 '05 #19
Andrew Koenig wrote:
"White Wolf" <wo***@freemail .hu> wrote in message
news:cv******** **@phys-news1.kolumbus. fi...
I cannot believe my eyes, but so far I could not find out what is the
name of the construct, which is built from one try block and the catch
clauses (handlers). I am not looking for a grammar name, but something
people can remember, like handler. But is not handler, because those
are the catch clauses and the try does not belong there. I have looked
at all my books and the standard, but I could not find a name. :-(

Is there anyone who knows that name? If there is, please share it with
me here. :-)


The C++ standard uses the term "try-block" to refer to the entire
statement, including all handlers, and does not appear to have a
separate name for the compound statement that appears between "try" and
the first "catch."
I had to look at the standard to find this out. Left to my own devices,
I would have used "try statement" to refer to the entire statement and
"subject of the try statement" to refer to the compound statement between
"try" and "catch."


Thanks. These names actually do make a lot of sense. I mean the "subject
of the try statement" states very nicely/clearly the purpose of that part.
I think I am going to make an update of my course material.

--
WW aka Attila
:::
Defeat isn't bitter if you don't swallow it.
Jul 23 '05 #20

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

Similar topics

39
6074
by: Erlend Fuglum | last post by:
Hi everyone, I'm having some trouble sorting lists. I suspect this might have something to do with locale settings and/or character encoding/unicode. Consider the following example, text containing norwegian special characters æ, ø and å. >>> liste =
13
11976
by: KefX | last post by:
This may have been discussed before, but I'm kind of confused as to why Python doesn't support having both an except ~and~ a finally clause, like this: try: raise RuntimeException except: print "What is the answer?" finally: print 42
7
9746
by: Robert Brewer | last post by:
Alex Martelli wrote in another thread: > One sign that somebody has moved from "Python newbie" to "good Python > programmer" is exactly the moment they realize why it's wrong to code: > > try: > x = could_raise_an_exception(23) > process(x) > except Exception, err: > deal_with_exception(err)
9
3830
by: David Stockwell | last post by:
In referring to my copy of the python bible, it tells me I can't use all three items 'try' except and finally. I can use the t/f or t/e combinations though What combination can i use if i want to catch the exception and still have a finally block? This is a fictional example of what I want....
26
2523
by: djw | last post by:
Hi, Folks- I have a question regarding the "proper" use of try: finally:... Consider some code like this: d = Device.open() try: d.someMethodThatCanRaiseError(...) if SomeCondition: raise Error # Error is subclass of Exception
6
3385
by: William Park | last post by:
(crossposted to comp.lang.python, because this may be of interest to them.) Python has try-block, within which you can raise exception. Once it's raised, execution breaks out of the try-block and is caught at the end of try-block. Now, Bash has similiar feature. I've added try-block and 'raise' builtin into Bash-3.0. Typical usage would go something like try
1
1769
by: djw | last post by:
c.l.p- I am having trouble understanding how one is supposed to correctly utilize try:...except:...finally: in real code. If I have a block of code like: def foo(): try: ... some code that can raise an exception ...
40
3047
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the goodness of Python whenever I talk with fellow developers, but I always hit a snag when it comes to discussing the finer points of the execution model (specifically, exceptions). Without fail, when I start talking with some of the "old-timers"...
3
2260
by: Sori Schwimmer | last post by:
Hi, I think that would be useful to have an improved version of the "try" statement, as follows: try(retrys=0,timeout=0): # things to try except: # what to do if failed
3
2029
by: Bob Rock | last post by:
Hello, this is something I've been asking myself for sometime ... and now I'd like to clarify this point. When should the try block start in a method??? What I mean is, does having all the code instead of a smaller set of it inside a try clause add any overhead??? 1What I'd like to understand is if, to be completely sure that no unhandles exception will get to the user, I can place all the code inside a try block and if this practice...
0
9666
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
10419
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...
0
10201
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...
0
9023
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...
0
5424
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
5552
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4100
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
2
3709
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2910
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.