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

Urgent!! /O2 is behavior wrong,My code problem or Microsofts??????????

Hi,Gurus:
I got a ATL COM+ component (VC++ 2003 7.1), inside IDL Method1 (COM
Method), I call another Class Method2 (C++ class), the Method2 throw a
custom excetption
throw CBusError (_T("Custom"),_T("1407"));

in Method1
try {
...
Class1.Method2()
}
catch(CErrorBase& e)
{
}
catch(...)
{
}

when compile with /O2 (Release Mode), I got a unexpected error, the error
only by catch(...), not by CErrorBase
but when compiled with /O1 (Release Mode) or in debug mode, it work as
expected the error caught by CErrorBase

also in Method2, I have
std::string strMessageCode = "1234";
std::string strMessageSeverity = "323";
cstring cx1=("LA1748");
if ((strMessageCode== cx1))
throw CBusError(_T("ALLTEL"),_T("LA1407"));
else
throw CBusError (_T("ALLTEL"),_T("LA1407"));

but if I change
if ((strMessageCode== cx1)) to
if (1==2)
it work as expected even under /O2 (Release Mode)

so what is my problem?
Memory Corruption????
O2 Bug in VC++????
please advice.

Thanks in advance.



class CErrorBase

{ public:

CErrorBase() ;

CErrorBase(IID IID,LPTSTR Source,CComBSTR UserID,LPCSTR
szLocation) ;

virtual ~CErrorBase ();

public:

tstring m_strErrorDescr;

CLSID m_IID;

protected:

void LogTxtError() ;

CComBSTR m_UserID;

cstring m_szLocation;

tstring m_szSource;

CComBSTR m_orgerrmsg;

public:

HRESULT hrError;

CComBSTR CisUserID();

virtual void LogError()=0;

void SetVar(IID IID,LPTSTR Source,CComBSTR UserID,LPCSTR szLocation)
;

void
LogErrorObject(ErrorObjectWrapper<PINFRASTRUCTUREL ib::ErrorObject> &Err);

} ;

class CBusError : public CErrorBase

{

public:

CBusError(IID IID,LPTSTR Source,CComBSTR UserID,LPCSTR
szLocation,CComBSTR bstrErrorNo);

CBusError(LPTSTR Source,CComBSTR bstrErrorNo,LPCSTR lpErrMsg) ;

CBusError(LPTSTR Source,CComBSTR bstrErrorNo) ;

private:

CComBSTR m_bstrErrorNo;

public:

virtual void LogError();

};


Nov 16 '05 #1
0 815

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

Similar topics

1
by: K R | last post by:
Hi, I have generated this XML from my application. But, when I open this XML, it is throwing error. Please help me to resolve this. <?xml version="1.0" encoding="utf-8" ?> <searchResults>...
3
by: Jeff Cooper | last post by:
Hey Folks, I have a bunch of aspx pages in a solution. One of these pages, call it header1.aspx, has it's code behind in header1.aspx.vb. Another, header2.aspx, has header2.aspx.vb. When I...
3
by: ItsMe | last post by:
Hi Guyz, I'm developing some application using third party api. They have given me sample project which is in VB6.0. I'm a newbie in vb.net. and the classic vb works perfectly alright. My job is...
8
by: VB Programmer | last post by:
I would appreciate your assistance on this ASP.NET 2.0 site.... This is the wierd problem: While accessing the built in .NET functions for 'profiling' or 'membership' an error is generated (see...
5
by: Elena | last post by:
I need the VB.NET code to change the header/footer of an Excel spread sheet, ASAP. I am doing it through a VB application. I can change the ranges/cell values using code, but I do not know how to...
6
by: Alvaro G. Vicario | last post by:
The code below inserts a <spantag around the image. It works fine in Firefox or Opera, but has a weird effect in Internet Explorer: browser keeps loading the image forever... Even though the...
1
by: dipenvekaria | last post by:
Can anyone help me with below error code i am in getting while running a C program using sqls. Password: password SQL Return Code: -25001 BATCH_LOG_PATH: Thank you, D
17
by: anojjona | last post by:
Hi, I need to figure out what some code that was maliciously executed against a database does. However, it's in a very strange format. It simply declares a variable and sets it equal to a huge...
3
by: coolguyaroundyou | last post by:
See the following code snippet: { int a=1; printf("%d %d %d",a,++a,a++); } Will the behavior be undefined/unspecifed or no such thing? Please state reasons, along with your post(s).
3
by: canabatz | last post by:
im using paging on this query: i got this code that returning wrong results: (SELECT bid_price, count(*) as n from bidding_details where bid_id=$bid_id GROUP BY bid_price DESC HAVING n = 1 ) ...
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
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
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
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.