473,467 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
Create 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 #1
19 2541
GB
White Wolf wrote:
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. :-)


It's called a try statement.

Gregg
Jul 23 '05 #2
GB wrote:
White Wolf wrote:
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. :-)


It's called a try statement.


Thanks. Could you tell me where can this be found? I have tried to find
"try statement" in the standard, in The C++ Programming Language Spec.
Edition and even Google.

As far as I can see the try statement is not used by C++ literature (it is
used in C# and Python), or where it is used it is used either as the synonim
for the try keyword or the try expression, none of which contains the whole
try-and-all-catch thing. That is why I have asked for source of
information, I cannot seem to find it.

--
WW aka Attila
:::
Give a man a fish and he will eat for a day. Teach a man to fish and he
will sit in a boat all day drinking beer.
Jul 23 '05 #3
GB
White Wolf wrote:
GB wrote:
White Wolf wrote:
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. :-)


It's called a try statement.

Thanks. Could you tell me where can this be found? I have tried to find
"try statement" in the standard, in The C++ Programming Language Spec.
Edition and even Google.
As far as I can see the try statement is not used by C++ literature (it is
used in C# and Python), or where it is used it is used either as the synonim
for the try keyword or the try expression, none of which contains the whole
try-and-all-catch thing. That is why I have asked for source of
information, I cannot seem to find it.


Well I have to admit, I looked (albeit briefly) and couldn't find a
definite answer either. That's just how I would refer to it. The grammar
treats the try-block as a statement and the catch handler as a
statement, but it is a semantic error to have one without the other, so
the whole construct would appear to me to be a statement. It is
certainly true that the whole construct can be used as one. For example:

if (cond)
try {
}
catch (...) {
}

I think maybe the standard calls the whole construct an exception
handler, which consists of a try clause and a catch clause.

Gregg
Jul 23 '05 #4
GB
White Wolf wrote:
GB wrote:
White Wolf wrote:
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. :-)


It's called a try statement.

Thanks. Could you tell me where can this be found? I have tried to find
"try statement" in the standard, in The C++ Programming Language Spec.
Edition and even Google.

As far as I can see the try statement is not used by C++ literature (it is
used in C# and Python), or where it is used it is used either as the synonim
for the try keyword or the try expression, none of which contains the whole
try-and-all-catch thing. That is why I have asked for source of
information, I cannot seem to find it.


Well I have to admit, I looked (albeit briefly) and couldn't find a
definite answer either. That's just how I would refer to it. The grammar
treats the try-block itself as a statement, but it would be a semantic
error to have the try-block without one or more matching catch clauses,
so the whole construct would appear to me to be a statement. It is
certainly true that the whole construct can be used as one. For example:

if (cond)
try {
}
catch (const myexc&) {
}
catch (...) {
}

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

Gregg
Jul 23 '05 #5
GB
White Wolf wrote:
GB wrote:
White Wolf wrote:
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. :-)


It's called a try statement.

Thanks. Could you tell me where can this be found? I have tried to find
"try statement" in the standard, in The C++ Programming Language Spec.
Edition and even Google.

As far as I can see the try statement is not used by C++ literature (it is
used in C# and Python), or where it is used it is used either as the synonim
for the try keyword or the try expression, none of which contains the whole
try-and-all-catch thing. That is why I have asked for source of
information, I cannot seem to find it.


Well I have to admit, I looked (albeit briefly) and couldn't find a
definite answer either. That's just how I would refer to it. The grammar
treats the try-block itself as a statement, but it would be a semantic
error to have the try-block without one or more matching catch clauses,
so the whole construct would appear to me to be a statement. It is
certainly true that the whole construct can be used as one. For example:

if (cond)
try {
}
catch (const myexc&) {
}
catch (...) {
}

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

Gregg
Jul 23 '05 #6
GB
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".

Gregg
Jul 23 '05 #7
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. :-(

--
WW aka Attila
:::
The easiest way to find something lost around the house is to buy a
replacement.
Jul 23 '05 #8
* 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"?

Just ignore the darned standard, it's very non-standard (heh) in its
terminology...

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #9
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 #10
GB
White Wolf wrote:
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. :-(


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.

Gregg
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
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...
13
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:...
7
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: > > ...
9
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...
26
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...
6
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...
1
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...
40
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...
3
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
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...
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:
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
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...
0
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...
0
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...
0
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 ...

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.