473,407 Members | 2,326 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,407 software developers and data experts.

where do exception specifications go?

according to standard it should be part of the declation
class A{

T somefunc()throw (SomeException);
};

yet I found it useful when it is also part of the definition

template<typename T>
T A<T>::someFunc()throw(SomeException){}

what is the usual style?

Oct 4 '05 #1
4 1122
Ian
ab****@gmail.com wrote:
according to standard it should be part of the declation
class A{

T somefunc()throw (SomeException);
};

yet I found it useful when it is also part of the definition

template<typename T>
T A<T>::someFunc()throw(SomeException){}

what is the usual style?

Yes, they are required in both declaration and definition. But in most
cases they are more trouble than they are worth.

Ian
Oct 4 '05 #2

ab****@gmail.com wrote:
according to standard it should be part of the declation
class A{

T somefunc()throw (SomeException);
};

yet I found it useful when it is also part of the definition
You are probably the first C++ programmer ever to find exception
specifications useful.
template<typename T>
T A<T>::someFunc()throw(SomeException){}

what is the usual style?


There is no usual style. No else uses them.

Greg

Oct 4 '05 #3
On 3 Oct 2005 21:28:49 -0700, "Greg" <gr****@pacbell.net> wrote:
yet I found it useful when it is also part of the definition


You are probably the first C++ programmer ever to find exception
specifications useful.


:-D

I dunno. I kinda like the way that exceptions are enforced as part of the
function type, as in Java.

Actually, never mind.

-dr
Oct 4 '05 #4
In message <u0********************************@4ax.com>, Dave Rahardja
<as*@me.com> writes
On 3 Oct 2005 21:28:49 -0700, "Greg" <gr****@pacbell.net> wrote:
yet I found it useful when it is also part of the definition
You are probably the first C++ programmer ever to find exception
specifications useful.


:-D

I dunno. I kinda like the way that exceptions are enforced as part of the
function type, as in Java.

"Enforced". I like that. The Mafia overtones have just the right ring.
Actually, never mind.


--
Richard Herring
Oct 6 '05 #5

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

Similar topics

6
by: Philipp Holzschneider | last post by:
Are there any available c++ compilers around that strictly implement the mentioned "Exception Specification" feature?? where the following compiles void func() { throw A(); }; void gunc()...
28
by: Scott Brady Drummonds | last post by:
Hi, all, I just got out of a meeting with a team of software developers that I recently joined as they are staffing to create a medium-sized project (potentially all of which will be written in...
10
by: linq936 | last post by:
Hi, I have many assert() call in my code, now I am considering to replace them with exception. The reason I want to do this change is that with the program going bigger and bigger, it is hard to...
6
by: benben | last post by:
Why doesn't the following code work? template <typename ExceptionT> void f(void) throw (ExceptionT) { throw ExceptionT(); } Ben
1
by: Brian | last post by:
I'm trying to comile some managed C++ code in VC++ 2005 beta that has a lot of exception specifications,ie int func() throw( SomeException*) ; I'm getting these messages: error C2353:...
13
by: junw2000 | last post by:
Is C++ Exception handling useful? think it is too complicated. What kinds of project need to use it? Thanks.
41
by: Stuart Golodetz | last post by:
Hi all, Just wondering whether there's any reason why exception specifications are enforced at runtime, rather than at compile-time like in Java? (This was prompted by reading an article on...
5
by: nospam_news | last post by:
When language changes make old code uncompilable, that's not what is called protection of investment. New compilers (g++ 3.2.3) reject classes where methods throw the class they belong to. gcc...
11
by: George2 | last post by:
Hello everyone, How do you understand the Bjarne's comments about exception specification? Especially, "not required to be checked across compilation-unit" and "violations will not be caught...
12
by: Ioannis Vranos | last post by:
Perhaps a mechanism can be introduced in the C++0x/1x standard, something simple like defining a function as: void somefunc(void) throw() { // ... }
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.