By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,657 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,657 IT Pros & Developers. It's quick & easy.

try-catch name

P: n/a
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
Share this Question
Share on Google+
19 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
* 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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a

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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.