Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Debugging / July 2003

Tip: Looking for answers? Try searching our database.

C4702 in exception throw

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doug Price - 25 Jul 2003 18:51 GMT
I'm porting an older VS 6 C++ application to NET 2003 and
getting a C4702 (unreachable code) warning at /W4 for the
following code:

throw new CArchiveException( CArchiveException::none,
User.GetName());

where User.GetName() is a function returning a CString.

The following code does *not* produce the warning:

CString  Name = User.GetName();
throw new CArchiveException( CArchiveException::none,
Name );

It looks to me like this is a bogus warning.  Is it?  Can
it be fixed?
Louis Lafreniere [VC++ Dev] - 30 Jul 2003 18:48 GMT
>From: "Doug Price" <dprice@hyperion.com>
>Message-ID: <004301c352d5$51fea360$a501280a@phx.gbl>
[quoted text clipped - 8 lines]
>It looks to me like this is a bogus warning.  Is it?  Can
>it be fixed?

It does look like a bogus warning.  What usually happens here is that some
compiler generated code gets inserted after the throw() and then triggers
the unreachable warning code.  I tried reproducing this with a small test
case from the line you gave but didn't get the warning.  Send me a
compilable repro case (you could preprocess your current file with -P)
along with your command line and I'll see what I can do.

Thanks.

Signature

Louis Lafreniere, Microsoft Visual C++ Dev Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.