473,322 Members | 1,755 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,322 software developers and data experts.

throw() after member function name - what for?

I saw something like this:

class Fred {
public:
void g() throw();
};

What is this throw() for? I did not even know that you could put it there.
Could anyone explain this to a C++ novice?
Aug 18 '07 #1
2 1774
k.w. wrote:
I saw something like this:

class Fred {
public:
void g() throw();
};

What is this throw() for? I did not even know that you could put it there.
Could anyone explain this to a C++ novice?
It states that the function will not throw any exceptions. The compiler
may be able to apply certain optimisations if a function only calls
others that do not throw exceptions.

--
Ian Collins.
Aug 18 '07 #2
Thanks.
Aug 18 '07 #3

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

Similar topics

3
by: Gianni Mariani | last post by:
This is one of those, hugh ? moments. So, GCC behaves just like I would kinda expect it to but it looks VERY strange. It's one of those things that could cause silent strife if you included...
12
by: Eric Lilja | last post by:
Hello, I'm working with a hash table that is encapsulated in a class. One of its member functions insert() throws an exception if the insertion fails (for example, if the value was already present...
4
by: Jurko Gospodnetiæ | last post by:
Hi all. I was wondering. Can the standard basic_string<> c_str() member function throw any exceptions? Is it perhaps implementation dependent? I tried checking the standard and as far as I...
3
by: Pierre Rouleau | last post by:
The std::exception class defined in the Standard C++ <exception> header specifies that the constructors could throw any exception becuase they do not have a throw() specification. Why is that? ...
6
by: Bill Rubin | last post by:
The following code snippet shows that VC++ 7.1 correctly compiles a static member function invocation from an Unrelated class, since this static member function is public. I expected to compile the...
28
by: Jess | last post by:
Hello, It is said that if I implement a "swap" member function, then it should never throw any exception. However, if I implement "swap" non- member function, then the restriction doesn't...
2
by: EasyVoip | last post by:
Hello, I have a hard time understanding what is going on here. This looks like a normal function definition, but what const throw is doing on the same line? Thanks for your help!!!! const...
28
by: gnuist006 | last post by:
I have some code like this: (if (test) (exit) (do something)) or (if (test)
19
by: Michael C | last post by:
If we have something like this object x = null; MessageBox.Show(x.ToString()) we get an error. That kindof makes sense but there is no reason the behaviour couldn't be to return an empty...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.