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

const what () const throw

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 char * what () const throw ()
{
return(std::invalid_argument::what());
};

Oct 19 '07 #1
2 14226
Ea******@gmail.com wrote:
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 char * what () const throw ()
{
return(std::invalid_argument::what());
};
It's a member function of an exception class. The const after the
parens says that it's a const member function (can be called on a const
object), and the throw() is an exception specification indicating that
it is guaranteed not to throw any exceptions.
Oct 19 '07 #2
Thanks
On Oct 19, 2:00 pm, red floyd <no.s...@here.dudewrote:
EasyV...@gmail.com wrote:
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 char * what () const throw ()
{
return(std::invalid_argument::what());
};

It's a member function of an exception class. The const after the
parens says that it's a const member function (can be called on a const
object), and the throw() is an exception specification indicating that
it is guaranteed not to throw any exceptions.

Oct 20 '07 #3

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

Similar topics

7
by: johny smith | last post by:
Can someone please explain to me the difference between these two: function1( const int a) function2( int const a) Both seemed to compile, but what is the difference between the two above....
1
by: Polanski24 | last post by:
Hello! Above function prototype is result of call to UnDecorateSymbolName Win32 API function. My problem is that I am not sure how to understand syntax of second parameter: "float const (*...
3
by: Heiko Vogel | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** Hi newsgroup, can anybody tell me, why the following code snippet won't compile: double **ptr; double const ** const c_ptr =...
23
by: grubertm | last post by:
When accessing pointer member variables these are not treated as const even though the instance is const. This came as a complete surprise to me and I would appreciate some feedback why that is the...
10
by: d3x0xr | last post by:
---- Section 1 ---- ------ x.c int main( void ) { char **a; char const *const *b; b = a; // line(9)
0
by: d3x0xr | last post by:
Heh, spelled out in black and white even :) Const is useles... do NOT follow the path of considering any data consatant, because in time, you will have references to it that C does not handle,...
17
by: Adrian Hawryluk | last post by:
Hi all, What is everyone's opinion of const inheriting? Should the object that a pointer is pointing at inherit the constness of the pointer? Such as in the case of a class having a pointer...
0
by: Chris Thomasson | last post by:
I am fine-tuning some last minute things in my c++ allocator lib and was thinking of ways to manage local references to system objects created with factory functions. I started to tinker around...
14
by: Jonas.Holmsten | last post by:
Hello I'm porting some C++ stuff to C and having problem to get it through gcc. Here is a condensed version of the problem: void foo(const int * const * const ptr) {} main()
39
by: Leonardo Korndorfer | last post by:
Hi, I'm litle confused by the const modifier, particularly when use const char* or char*. Some dude over here said it should be const char when you dont modify it content inside the function, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.