473,779 Members | 1,952 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 #1
19 2571
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
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 #10

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

Similar topics

39
6071
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
9743
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
3828
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
2522
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
3384
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
1767
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
3044
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
2256
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
2027
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
10306
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...
1
10074
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
9930
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...
1
7485
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
6724
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
5373
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
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
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
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.