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

Invalid return path checking on inline C++ methods (VS.NET 2003)

Hi,

I am back with more bug reports from Visual Studio.NET 2003's C++ compiler
(unmanaged). Consider the following method:

---------------------------------------------
__forceinline
bool CReplayBase::ReplayFillBuffer()
{
CFile* pFile = NULL;
for(int i=0; i<m_FileList.GetCount(); i++)
{
pFile = m_FileList.GetAt ;
}
}
---------------------------------------------

It is has bool return type, but no path returns any values. Obviously this
is an error and should not compile. Yet it does!

Now comment out the __forceinline and it stops compiling and reports the
error of "not all control paths return a value."

Any thoughts? We can certainly live with this bug, but it'd be better if it
was fixed.

Thanks in advance,
Michael
Nov 16 '05 #1
7 1539
Hi Michael,,

Thanks for your feedback in this group!

I have reproduced it and am performing research on it. I will get back here
with more information as soon as possible.

Best Regards!

Gary Chang
Microsoft Online Partner Support
Get Secure! – www.microsoft.com/security
This posting is provided "AS IS" with no warranties,and confers no rights.
--------------------
| From: "Michael Kennedy [UB]" <mk******@REMOVETHIS.unitedbinary.com>
| Subject: Invalid return path checking on inline C++ methods (VS.NET 2003)
| Date: Wed, 22 Oct 2003 15:30:49 -0700
| Lines: 30
| Organization: United Binary, LLC.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#p**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:29661
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| Hi,
|
| I am back with more bug reports from Visual Studio.NET 2003's C++ compiler
| (unmanaged). Consider the following method:
|
| ---------------------------------------------
| __forceinline
| bool CReplayBase::ReplayFillBuffer()
| {
| CFile* pFile = NULL;
| for(int i=0; i<m_FileList.GetCount(); i++)
| {
| pFile = m_FileList.GetAt ;
| }
| }
| ---------------------------------------------
|
| It is has bool return type, but no path returns any values. Obviously this
| is an error and should not compile. Yet it does!
|
| Now comment out the __forceinline and it stops compiling and reports the
| error of "not all control paths return a value."
|
| Any thoughts? We can certainly live with this bug, but it'd be better if
it
| was fixed.
|
| Thanks in advance,
| Michael
|
|
|

Nov 16 '05 #2
Hi Micheal,

I think you hadn't called the inline method in your code, if you add a
call to it , you should get a "error C4716: 'CReplayBase::ReplayFillBuffer'
: must return a value".

However, It is a quirk of how we implement that diagnostic. Our product
dev team explained that the code generator issues the diagnostic (mainly
because the parser doesn't build a flow graph), but the parser notices that
the function is never called and it's inline, so the code generator never
sees it.

Does that answer your problem?
Best regards!

Gary Chang
Microsoft Online Partner Support
Get Secure! – www.microsoft.com/security
This posting is provided "AS IS" with no warranties,and confers no rights.
--------------------

Nov 16 '05 #3
Hi Gary,

Thanks for looking into this. I think that you are right about it not being
called in our code. That problem was something we noticed while we were
building the method.

I guess it's sort of a "If a tree falls in the forest and no body is around
to hear it, does it make a noise?" type of situation. But here we have "If
the method is never called, does anyone notice the missing return value?"

Regards,
Michael

"Gary Chang [MSFT]" <v-******@online.microsoft.com> wrote in message
news:UF*************@cpmsftngxa06.phx.gbl...
Hi Micheal,

I think you hadn't called the inline method in your code, if you add a
call to it , you should get a "error C4716: 'CReplayBase::ReplayFillBuffer' : must return a value".

However, It is a quirk of how we implement that diagnostic. Our product
dev team explained that the code generator issues the diagnostic (mainly
because the parser doesn't build a flow graph), but the parser notices that the function is never called and it's inline, so the code generator never
sees it.

Does that answer your problem?
Best regards!

Gary Chang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties,and confers no rights.
--------------------

Nov 16 '05 #4
Hi Michael,

Thanks for your response!

I agree with you on this point: "The compilier seems do not want to hear a
tree falling in the forest.", maybe it is a issue will be considered
seriously.

Best regards!

Gary Chang
Microsoft Online Partner Support
Get Secure! – www.microsoft.com/security
This posting is provided "AS IS" with no warranties,and confers no rights.
--------------------
| From: "Michael Kennedy [UB]" <mk******@REMOVETHIS.unitedbinary.com>
| References: <#p**************@tk2msftngp13.phx.gbl>
<UF*************@cpmsftngxa06.phx.gbl>
| Subject: Re: Invalid return path checking on inline C++ methods (VS.NET
2003)
| Date: Thu, 23 Oct 2003 09:12:05 -0700
| Lines: 42
| Organization: United Binary, LLC.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uq**************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:29681
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| Hi Gary,
|
| Thanks for looking into this. I think that you are right about it not
being
| called in our code. That problem was something we noticed while we were
| building the method.
|
| I guess it's sort of a "If a tree falls in the forest and no body is
around
| to hear it, does it make a noise?" type of situation. But here we have "If
| the method is never called, does anyone notice the missing return value?"
|
| Regards,
| Michael
|
| "Gary Chang [MSFT]" <v-******@online.microsoft.com> wrote in message
| news:UF*************@cpmsftngxa06.phx.gbl...
| > Hi Micheal,
| >
| > I think you hadn't called the inline method in your code, if you add a
| > call to it , you should get a "error C4716:
| 'CReplayBase::ReplayFillBuffer'
| > : must return a value".
| >
| > However, It is a quirk of how we implement that diagnostic. Our product
| > dev team explained that the code generator issues the diagnostic (mainly
| > because the parser doesn't build a flow graph), but the parser notices
| that
| > the function is never called and it's inline, so the code generator
never
| > sees it.
| >
| > Does that answer your problem?
| >
| >
| > Best regards!
| >
| > Gary Chang
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "AS IS" with no warranties,and confers no
rights.
| > --------------------
| >
|
|
|

Nov 16 '05 #5
Hi Gary,

You're welcome. Thanks again for looking into this issue.

Regards,
Michael

"Gary Chang [MSFT]" <v-******@online.microsoft.com> wrote in message
news:vp*************@cpmsftngxa06.phx.gbl...
Hi Michael,

Thanks for your response!

I agree with you on this point: "The compilier seems do not want to hear a tree falling in the forest.", maybe it is a issue will be considered
seriously.

Best regards!

Gary Chang
Microsoft Online Partner Support
Get Secure! – www.microsoft.com/security
This posting is provided "AS IS" with no warranties,and confers no rights.
--------------------
| From: "Michael Kennedy [UB]" <mk******@REMOVETHIS.unitedbinary.com>
| References: <#p**************@tk2msftngp13.phx.gbl>
<UF*************@cpmsftngxa06.phx.gbl>
| Subject: Re: Invalid return path checking on inline C++ methods (VS.NET
2003)
| Date: Thu, 23 Oct 2003 09:12:05 -0700
| Lines: 42
| Organization: United Binary, LLC.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uq**************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:29681
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| Hi Gary,
|
| Thanks for looking into this. I think that you are right about it not
being
| called in our code. That problem was something we noticed while we were
| building the method.
|
| I guess it's sort of a "If a tree falls in the forest and no body is
around
| to hear it, does it make a noise?" type of situation. But here we have "If | the method is never called, does anyone notice the missing return value?" |
| Regards,
| Michael
|
| "Gary Chang [MSFT]" <v-******@online.microsoft.com> wrote in message
| news:UF*************@cpmsftngxa06.phx.gbl...
| > Hi Micheal,
| >
| > I think you hadn't called the inline method in your code, if you add a | > call to it , you should get a "error C4716:
| 'CReplayBase::ReplayFillBuffer'
| > : must return a value".
| >
| > However, It is a quirk of how we implement that diagnostic. Our product | > dev team explained that the code generator issues the diagnostic (mainly | > because the parser doesn't build a flow graph), but the parser notices
| that
| > the function is never called and it's inline, so the code generator
never
| > sees it.
| >
| > Does that answer your problem?
| >
| >
| > Best regards!
| >
| > Gary Chang
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "AS IS" with no warranties,and confers no
rights.
| > --------------------
| >
|
|
|

Nov 16 '05 #6
This situation also arises with member functions of template classes.
Compilers can't compile such code, without knowing the template parameters,
so they ignore it, unless you actually call it.

Keith MacDonald

"Michael Kennedy [UB]" <mk******@REMOVETHIS.unitedbinary.com> wrote in
message news:ur**************@TK2MSFTNGP11.phx.gbl...
Hi Gary,

You're welcome. Thanks again for looking into this issue.

Regards,
Michael

"Gary Chang [MSFT]" <v-******@online.microsoft.com> wrote in message
news:vp*************@cpmsftngxa06.phx.gbl...
Hi Michael,

Thanks for your response!

I agree with you on this point: "The compilier seems do not want to hear
a
tree falling in the forest.", maybe it is a issue will be considered
seriously.

Best regards!

Gary Chang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties,and confers no
rights. --------------------
| From: "Michael Kennedy [UB]" <mk******@REMOVETHIS.unitedbinary.com>
| References: <#p**************@tk2msftngp13.phx.gbl>
<UF*************@cpmsftngxa06.phx.gbl>
| Subject: Re: Invalid return path checking on inline C++ methods (VS.NET 2003)
| Date: Thu, 23 Oct 2003 09:12:05 -0700
| Lines: 42
| Organization: United Binary, LLC.
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uq**************@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:29681
| X-Tomcat-NG: microsoft.public.dotnet.languages.vc
|
| Hi Gary,
|
| Thanks for looking into this. I think that you are right about it not
being
| called in our code. That problem was something we noticed while we were | building the method.
|
| I guess it's sort of a "If a tree falls in the forest and no body is
around
| to hear it, does it make a noise?" type of situation. But here we have

"If
| the method is never called, does anyone notice the missing return

value?"
|
| Regards,
| Michael
|
| "Gary Chang [MSFT]" <v-******@online.microsoft.com> wrote in message
| news:UF*************@cpmsftngxa06.phx.gbl...
| > Hi Micheal,
| >
| > I think you hadn't called the inline method in your code, if you add a
| > call to it , you should get a "error C4716:
| 'CReplayBase::ReplayFillBuffer'
| > : must return a value".
| >
| > However, It is a quirk of how we implement that diagnostic. Our

product
| > dev team explained that the code generator issues the diagnostic

(mainly
| > because the parser doesn't build a flow graph), but the parser

notices | that
| > the function is never called and it's inline, so the code generator
never
| > sees it.
| >
| > Does that answer your problem?
| >
| >
| > Best regards!
| >
| > Gary Chang
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "AS IS" with no warranties,and confers no
rights.
| > --------------------
| >
|
|
|


Nov 16 '05 #7
Keith MacDonald wrote:
This situation also arises with member functions of template classes.
Compilers can't compile such code, without knowing the template
parameters, so they ignore it, unless you actually call it.


Yes - VC will fail to diagnose many errors in uninstantiated templates.
It's a limitation of the way in which VC handles templates - they're
basically fancy macros and aren't really checked until the compiler tries to
instantiate them.

-cd
Nov 16 '05 #8

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

Similar topics

7
by: NotGiven | last post by:
I am sending email using the mail() function on a hosted account. I am trying to override the RETURN-PATH variable but it is not working. The server keeps overriding the variable I put in. ...
0
by: Emmett Power | last post by:
Hi, I have a newsletter that I send to customers using CDO for Exchange 2000/Visual Basic in an Access database with Outlook 2003. I want to track the message id and return path to remove...
4
by: evan.cooch | last post by:
Greetings. Suppose I have some function called "CheckIt" - some function to validate form data before submitting it to e CGI script. Pretend the name of the form is "TheForm". If I use the...
11
by: Jonah Olsson | last post by:
Hi guys, I'm trying to figure out how to use MailMessage to send mails with a different return path than the sender if the delivery fails. Here's the case: Sender: Joe's Pizza Sender email:...
1
by: Xerxes | last post by:
Hi, I get the "Invalid return" error (in Javascript console) when I run this piece of code: <a href="javascript:if (document.dc_form.tn.value == ''' && document.dc_form.cid.value == '') {...
0
by: westlog104 | last post by:
Hi, I have a problem with CDO.Message bounce back. when the email bounce back, the bounce back email will send back to address: Sender or
2
by: Adam R | last post by:
I want to use mail() function but I can't overwrite Retun-Path info. Most mail servers overwrite the 'Return-path' header sent by the PHP mail() function by a default email address...
0
by: Ewen | last post by:
Hi, I've searched the forums but can't find a specific answer to this particular problem. We're using ServerObjects ASPMail (SMTPSVG.DLL) to send system generated emails on behalf of users of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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:
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.