473,608 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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::Re playFillBuffer( )
{
CFile* pFile = NULL;
for(int i=0; i<m_FileList.Ge tCount(); i++)
{
pFile = m_FileList.GetA t ;
}
}
---------------------------------------------

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 1552
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******@REMOV ETHIS.unitedbin ary.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.publi c.dotnet.langua ges.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:29661
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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::Re playFillBuffer( )
| {
| CFile* pFile = NULL;
| for(int i=0; i<m_FileList.Ge tCount(); i++)
| {
| pFile = m_FileList.GetA t ;
| }
| }
| ---------------------------------------------
|
| 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::R eplayFillBuffer '
: 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.m icrosoft.com> wrote in message
news:UF******** *****@cpmsftngx a06.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::R eplayFillBuffer ' : 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******@REMOV ETHIS.unitedbin ary.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.publi c.dotnet.langua ges.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:29681
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.m icrosoft.com> wrote in message
| news:UF******** *****@cpmsftngx a06.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::R eplayFillBuffer '
| > : 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.m icrosoft.com> wrote in message
news:vp******** *****@cpmsftngx a06.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******@REMOV ETHIS.unitedbin ary.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.publi c.dotnet.langua ges.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:29681
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.m icrosoft.com> wrote in message
| news:UF******** *****@cpmsftngx a06.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::R eplayFillBuffer '
| > : 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******@REMOV ETHIS.unitedbin ary.com> wrote in
message news:ur******** ******@TK2MSFTN GP11.phx.gbl...
Hi Gary,

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

Regards,
Michael

"Gary Chang [MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:vp******** *****@cpmsftngx a06.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******@REMOV ETHIS.unitedbin ary.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.publi c.dotnet.langua ges.vc
| NNTP-Posting-Host: 130.191.240.187
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP11.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vc:29681
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.m icrosoft.com> wrote in message
| news:UF******** *****@cpmsftngx a06.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::R eplayFillBuffer '
| > : 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
12358
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. Here's what I have: ..... $headers = "From: me <me@mine.com>\r\n" $headers .= "Return-Path: me <me@mine.com>\r\n"; .....
0
2978
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 bounces and remove requests from customers. So far I have been unable to do so. I've tinkered with it for hours using various variations on:
4
6856
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 following code, everything work perfctly: <Input type=button VALUE="Submit your form" onClick="javascript:return CheckIt(TheForm)">
11
2554
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: joe@pizza.com Receiver: Matt Hill (from repository)
1
3609
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 == '') { alert('You have not made a selection. Please select one of the fields first.');return false; } document.dc_form.submit();">Go!</a> If I remove the "return false;", it displayes the alert and continues
0
2826
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
2063
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 (httpd@hostingcompany.com or apache@domain.org). I tried : $headers = 'From: MyName<'.$from.'>\r\n'; $headers .= 'Return-Path: MyName<'.$from.'>\r\n';
0
1933
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 our sites. As such, we need to set 'correct' Return-Path: and Sender: headers in those emails. I'm using Mailer.AddExtraHeader to do this, in the following code: Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.RemoteHost =...
0
8063
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8496
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8475
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6816
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6013
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4024
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2474
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1594
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1329
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.