473,513 Members | 2,275 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

funny problem about funtion-try-block in vc7.1

Following code can't pass compilation

class CLS
:public exception
{
public:
CLS():exception("111")
{
}
};

void Fun()
try
{
throw CLS();
}
catch(...)
{
}
//; //adding this semicolon can pass compilation.

void Fun1()
{
}

if the class CLS does not derive from std::exception,it can pass compilation
too.

i think that this is a bug.
Nov 17 '05 #1
2 997
please add 2 line at the top of the source codes;

#include <exception>
using namespace std;

"booker" <hu**********@kingsoft.net> дÈëÓʼþ
news:uv**************@TK2MSFTNGP09.phx.gbl...
Following code can't pass compilation

class CLS
:public exception
{
public:
CLS():exception("111")
{
}
};

void Fun()
try
{
throw CLS();
}
catch(...)
{
}
//; //adding this semicolon can pass compilation.

void Fun1()
{
}

if the class CLS does not derive from std::exception,it can pass compilation too.

i think that this is a bug.

Nov 17 '05 #2
i have further discovery

class CLS
{
public:
virtual ~CLS()
{
}
};

void Fun()
try
{
throw CLS();
}
catch(...)
{
}
//; //adding this can pass compilation

void Fun1()
{
}

try these.

"booker" <hu**********@kingsoft.net> дÈëÓʼþ
news:uv**************@TK2MSFTNGP09.phx.gbl...
Following code can't pass compilation

class CLS
:public exception
{
public:
CLS():exception("111")
{
}
};

void Fun()
try
{
throw CLS();
}
catch(...)
{
}
//; //adding this semicolon can pass compilation.

void Fun1()
{
}

if the class CLS does not derive from std::exception,it can pass compilation too.

i think that this is a bug.

Nov 17 '05 #3

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

Similar topics

0
1645
by: yang | last post by:
Deal all: I want to call the funtion of cryptapi (such as cryptaccquirecontext etc) in asp, and if it runat at client, it's ok,but if it run at server in IIS(as the same machine), it return...
65
5280
by: perseus | last post by:
I think that everyone who told me that my question is irrelevant, in particular Mr. David White, is being absolutely ridiculous. Obviously, most of you up here behave like the owners of the C++...
3
3122
by: Ye Liu | last post by:
Hi, Folks. If I have table create table t1(col1 number getnumber()) // getnumber is a funtion to generate default value of col1. How I can get this function string by a query on data...
6
3165
by: | last post by:
Say we have the following code defining TMyMsgHandler and TMyClass typedef void (*TOnMsgReceive) (TMyMessage Msg); class TMyMsgHandler { public: TMyMsgHandler(); virtual ~TMyMsgHandler();...
6
1703
by: JS | last post by:
I am writing som C code and was wondering if I should call the filename the same as the name of my function. It compiles ok but should I make a file for each funtion just to keep it orderly or is...
8
3011
by: MarsFossils | last post by:
I am giving a lunch and learn talk on how to "Create your own Web Page" tomorrow and would like to mention a funny anecdote with an inspiring moral about web page design. Does anybody have any...
9
3099
by: Salad | last post by:
The other day my friends were on the web ready to purchase some tickets on-line for a concert. There was a textbox to enter their e-mail address and another to enter a password. So they entered...
3
5126
by: jitu.csewizard | last post by:
hi overview: function sprintf(<buffername>,<format string>, .....) in this function you need to allocate the size of buffername before hand. question: function ssprintf(<buffername>,<format...
1
1821
by: sridhard2406 | last post by:
Hi All, I am new to c++, please find my program below and my doubt as mentioned below. #include <iostream> using namespace std; class base { public:
0
7265
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
7171
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
7547
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...
1
7114
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
7541
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
5693
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,...
1
5098
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...
0
3240
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...
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.