473,808 Members | 2,885 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is this code doing?

Hello, under vc7.1 this code compiles:

if (!parent.fillTo ol)
parent.fillTool .dispose;

where dispose is a method of fillTool.

Notice that dispose does not have ( ) behind it.

Under vc8, this generates an error.

The question is, what is it doing under vc7.1?

Is it actually doing the function call? Or does it think this is just
some function reference and not doing the call?

Thanks.

May 31 '07 #1
9 1986
oddvark wrote:
Hello, under vc7.1 this code compiles:

if (!parent.fillTo ol)
parent.fillTool .dispose;

where dispose is a method of fillTool.

Notice that dispose does not have ( ) behind it.

Under vc8, this generates an error.

The question is, what is it doing under vc7.1?

Is it actually doing the function call? Or does it think this is just
some function reference and not doing the call?
My guess is that it's evaluating the rvalue for the address of {whatever
class fillTool is}::dispose, and ignoring it.
May 31 '07 #2
"oddvark" <dg*****@yahoo. comwrote in message
news:11******** **************@ i13g2000prf.goo glegroups.com.. .
Hello, under vc7.1 this code compiles:

if (!parent.fillTo ol)
parent.fillTool .dispose;

where dispose is a method of fillTool.

Notice that dispose does not have ( ) behind it.

Under vc8, this generates an error.

The question is, what is it doing under vc7.1?

Is it actually doing the function call? Or does it think this is just
some function reference and not doing the call?
Well, a function name is a pointer. And you can do things with pointers.
But in this case, it seems like it's just evaluating the pointer and doing
nothing with it. The same thing as a statement like:

12;

It compiles, but basically does nothing.
Jun 1 '07 #3
On Jun 1, 4:15 am, "Jim Langston" <tazmas...@rock etmail.comwrote :
"oddvark" <dgrd...@yahoo. comwrote in message

news:11******** **************@ i13g2000prf.goo glegroups.com.. .
Hello, under vc7.1 this code compiles:
if (!parent.fillTo ol)
parent.fillTool .dispose;
where dispose is a method of fillTool.
Notice that dispose does not have ( ) behind it.
Under vc8, this generates an error.
The question is, what is it doing under vc7.1?
Is it actually doing the function call? Or does it think this is just
some function reference and not doing the call?

Well, a function name is a pointer. And you can do things with pointers.
But in this case, it seems like it's just evaluating the pointer and doing
nothing with it. The same thing as a statement like:

12;

It compiles, but basically does nothing.
member function pointer are not combined with object pointers to
esablish a pointer to function in C++.there is nothing such as
delegates in standard C++(in MS C# this would have a meaning).So the
question is still on.why should that line generate an error in a
compiler?.

Jun 1 '07 #4
On Jun 1, 9:19 am, terminator <farid.mehr...@ gmail.comwrote:
>why should that line generate an error in a compiler?.
- Hide quoted text -
>
- Show quoted text -
Sorry.why should that line not generate an error in a compiler?.

Jun 1 '07 #5
terminator wrote:
On Jun 1, 9:19 am, terminator <farid.mehr...@ gmail.comwrote:
>why should that line generate an error in a compiler?.
- Hide quoted text -
>- Show quoted text -

Sorry.why should that line not generate an error in a compiler?.
Because it's a nop.

--
Ian Collins.
Jun 1 '07 #6
terminator wrote:
Sorry.why should that line not generate an error in a compiler?.
Because C++ allows rvalues which are not used for anything in
a sentence.
Jun 1 '07 #7
Jim Langston wrote:
>
Well, a function name is a pointer.
That's almost true for ordinary functions, but not for member functions.
For ordinary funtions, the name of the function decays into a pointer to
the function in most contexts. There is no such rule for member function
names.
And you can do things with pointers.
But in this case, it seems like it's just evaluating the pointer and doing
nothing with it. The same thing as a statement like:

12;

It compiles, but basically does nothing.
That is, in fact, what MS's compilers used to do. But the code is
ill-formed.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
Jun 1 '07 #8
Ian Collins wrote:
terminator wrote:
>On Jun 1, 9:19 am, terminator <farid.mehr...@ gmail.comwrote:
>>why should that line generate an error in a compiler?.
- Hide quoted text -
>>- Show quoted text -
Sorry.why should that line not generate an error in a compiler?.

Because it's a nop.
No, it's illegal.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
Jun 1 '07 #9
Juha Nieminen wrote:
terminator wrote:
>Sorry.why should that line not generate an error in a compiler?.

Because C++ allows rvalues which are not used for anything in
a sentence.
But the name of a member function is not an rvalue. The reason it
doesn't generate a diagnostic in MS's older compilers is that those
compilers are wrong.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
Jun 1 '07 #10

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

Similar topics

220
19201
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
92
6553
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
125
14874
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
4
330
by: Charlie | last post by:
Hello, As only doing research in academic (working on IR), I have no idea of what is going on in industry, and what is in demand. Answering any of the following questions would be very helpful!! 1>I wonder what is the job market for compiler writters? - from www.compilerjobs.com, I see only Embedded/media processor is creating job openings..?
121
10202
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
46
4269
by: Keith K | last post by:
Having developed with VB since 1992, I am now VERY interested in C#. I've written several applications with C# and I do enjoy the language. What C# Needs: There are a few things that I do believe MSFT should do to improve C#, however. I know that in the "Whidbey" release of VS.NET currently
13
5065
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
12
17432
by: Nathan Sokalski | last post by:
What is the difference between the Page_Init and Page_Load events? When I was debugging my code, they both seemed to get triggered on every postback. I am assuming that there is some difference, and I would like to know what it is so that I can take advantage of it in my code. Thanks. -- Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/
8
2071
by: watkinsdev | last post by:
Hi, I have created a mesh class in visual studio 6.0 c++. I can create a device, render objects and can edit the objects by for instancnce selecting a cluster of vertices and processing the vertices and can do this multiple times on a sinlge vertex cluster. The problem I have been encoutering is that, if I select a second vertex cluster and try to edit that , the program crashes.
10
1735
by: timor.super | last post by:
Hi all, Imagine I've an array of int : int anArray = new int; I want to extract all the integer that are superior to 500 I can do :
0
10374
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...
1
10374
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7651
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
6880
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
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
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
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.