Hello, under vc7.1 this code compiles:
if (!parent.fillTool)
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. 9 1953
oddvark wrote:
Hello, under vc7.1 this code compiles:
if (!parent.fillTool)
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.
"oddvark" <dg*****@yahoo.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
Hello, under vc7.1 this code compiles:
if (!parent.fillTool)
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.
On Jun 1, 4:15 am, "Jim Langston" <tazmas...@rocketmail.comwrote:
"oddvark" <dgrd...@yahoo.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
Hello, under vc7.1 this code compiles:
if (!parent.fillTool)
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?.
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?.
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.
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.
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)
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)
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) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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?...
|
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...
|
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!!...
|
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...
|
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...
|
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
|
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,...
|
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...
|
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 :
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |