Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > exception specification

Reply
Thread Tools

exception specification

 
 
Tony Johansson
Guest
Posts: n/a
 
      05-30-2005
Hello!

In this overloaded index operator I have just add this throw() in the header
just to check what happen when an exception is thrown.
This throw() in the header should means that this method should not throw
anything.
But the strange thing is that I don't get any error when this user defined
exception MyOutOfRange is throw.
Can anybody explain that to me?

int& operator[](int i) throw() ; //Here is the declaration

int& Intvektor:perator[](int i) throw()
{
if (i >= size || i < 0)
throw MyOutOfRange("Intvektor:: Positionering som ligger utanför
giltigt område\n");
return array[i];
}

//Tony


 
Reply With Quote
 
 
 
 
Rapscallion
Guest
Posts: n/a
 
      05-30-2005
Tony Johansson wrote:
> In this overloaded index operator I have just add this throw() in the header
> just to check what happen when an exception is thrown.
> This throw() in the header should means that this method should not throw
> anything.
> But the strange thing is that I don't get any error when this user defined
> exception MyOutOfRange is throw.
> Can anybody explain that to me?


You mean, you get no runtime error? Then you are probably using a
Microsoft compiler. MS decided to not fully support the C++ Standard
WRT exception specifications.

 
Reply With Quote
 
 
 
 
Gianni Mariani
Guest
Posts: n/a
 
      05-30-2005
Tony Johansson wrote:
> Hello!
>
> In this overloaded index operator I have just add this throw() in the header
> just to check what happen when an exception is thrown.
> This throw() in the header should means that this method should not throw
> anything.
> But the strange thing is that I don't get any error when this user defined
> exception MyOutOfRange is throw.
> Can anybody explain that to me?



Which compiler were you using ?
 
Reply With Quote
 
Tony Johansson
Guest
Posts: n/a
 
      05-30-2005

"Gianni Mariani" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> Tony Johansson wrote:
>> Hello!
>>
>> In this overloaded index operator I have just add this throw() in the
>> header just to check what happen when an exception is thrown.
>> This throw() in the header should means that this method should not throw
>> anything.
>> But the strange thing is that I don't get any error when this user
>> defined exception MyOutOfRange is throw.
>> Can anybody explain that to me?

>
>
> Which compiler were you using ?


I'm using MS .net


 
Reply With Quote
 
Tony Johansson
Guest
Posts: n/a
 
      05-30-2005

"Rapscallion" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed) oups.com...
> Tony Johansson wrote:
>> In this overloaded index operator I have just add this throw() in the
>> header
>> just to check what happen when an exception is thrown.
>> This throw() in the header should means that this method should not throw
>> anything.
>> But the strange thing is that I don't get any error when this user
>> defined
>> exception MyOutOfRange is throw.
>> Can anybody explain that to me?

>
> You mean, you get no runtime error? Then you are probably using a
> Microsoft compiler. MS decided to not fully support the C++ Standard
> WRT exception specifications.
>

What does WRT mean?

//Tony


 
Reply With Quote
 
Artie Gold
Guest
Posts: n/a
 
      05-30-2005
Tony Johansson wrote:
> "Rapscallion" <(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed) oups.com...
>
>>Tony Johansson wrote:
>>
>>>In this overloaded index operator I have just add this throw() in the
>>>header
>>>just to check what happen when an exception is thrown.
>>>This throw() in the header should means that this method should not throw
>>>anything.
>>>But the strange thing is that I don't get any error when this user
>>>defined
>>>exception MyOutOfRange is throw.
>>>Can anybody explain that to me?

>>
>>You mean, you get no runtime error? Then you are probably using a
>>Microsoft compiler. MS decided to not fully support the C++ Standard
>>WRT exception specifications.
>>

>
> What does WRT mean?


"With Respect To"

HTH,
--ag

--
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bjarne's comments about exception specification George2 C++ 14 01-22-2008 05:03 AM
Is an exception specification needed if the method throws and catchesits own exception? elcapitan666@gmail.com C++ 2 11-27-2007 04:01 AM
Exception specification checked at *runtime*? Paul Brettschneider C++ 8 11-03-2007 10:14 AM
Strange Exception Specification Behaviour Paul Drummond C++ 2 06-08-2005 02:59 PM
connection string exception : Format of the initialization string does not conform to specification starting at index 0 Gaurav ASP .Net 0 11-07-2003 10:24 AM



Advertisments