Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   So it has been proven (http://www.velocityreviews.com/forums/t744384-so-it-has-been-proven.html)

Paul 03-01-2011 06:53 PM

So it has been proven
 
So it has been proven that, in C++, a nonstatic member function is indeed
different from an ordinary function in more fundamental ways than simply
calling syntax.

I see most of the original arguers dropped out of the argument and those
that persued their argument have since quietly slipped away.

I guess its not important enough to those people but I always considered it
important to understand the basics.
GL.



Paul 03-01-2011 07:19 PM

Re: So it has been proven
 

"Leigh Johnston" <leigh@i42.co.uk> wrote in message
news:aLKdnRT37p6y3_DQnZ2dnUVZ8kGdnZ2d@giganews.com ...
> On 01/03/2011 18:53, Paul wrote:
>> So it has been proven that, in C++, a nonstatic member function is
>> indeed different from an ordinary function in more fundamental ways than
>> simply calling syntax.

>
> You have failed to prove anything whatsoever.
>
>>
>> I see most of the original arguers dropped out of the argument and those
>> that persued their argument have since quietly slipped away.

>
> If any have slipped away then it is probably due to them being fed up with
> your tedious, repetitive incorrect posts and your inability to accept your
> mistakes.
>
>>
>> I guess its not important enough to those people but I always considered
>> it important to understand the basics.

>
> The basics:
>
> In C++ a member function is a member of a class not a member of an object.
>
> HTH.
>
> /Leigh


Leigh I have already requested that you stop replying to my posts , I don't
want to be nasty but that is all you seem to provoke. You have no
intelligence and I feel sorry for you. Go away unless you can produce some
reasonably intelligent conversation.

..


Paul 03-01-2011 07:42 PM

Re: So it has been proven
 

"Leigh Johnston" <leigh@i42.co.uk> wrote in message
news:JNmdnUHqUKYJ1fDQnZ2dnUVZ8qWdnZ2d@giganews.com ...
> On 01/03/2011 19:19, Paul wrote:
>>
>> "Leigh Johnston" <leigh@i42.co.uk> wrote in message
>> news:aLKdnRT37p6y3_DQnZ2dnUVZ8kGdnZ2d@giganews.com ...
>>> On 01/03/2011 18:53, Paul wrote:
>>>> So it has been proven that, in C++, a nonstatic member function is
>>>> indeed different from an ordinary function in more fundamental ways
>>>> than
>>>> simply calling syntax.
>>>
>>> You have failed to prove anything whatsoever.
>>>
>>>>
>>>> I see most of the original arguers dropped out of the argument and
>>>> those
>>>> that persued their argument have since quietly slipped away.
>>>
>>> If any have slipped away then it is probably due to them being fed up
>>> with your tedious, repetitive incorrect posts and your inability to
>>> accept your mistakes.
>>>
>>>>
>>>> I guess its not important enough to those people but I always
>>>> considered
>>>> it important to understand the basics.
>>>
>>> The basics:
>>>
>>> In C++ a member function is a member of a class not a member of an
>>> object.
>>>
>>> HTH.
>>>
>>> /Leigh

>>
>> Leigh I have already requested that you stop replying to my posts , I
>> don't want to be nasty but that is all you seem to provoke. You have no
>> intelligence and I feel sorry for you. Go away unless you can produce
>> some reasonably intelligent conversation.
>>

>
> Please feel free to killfile those with whom you disagree; it would mean a
> lot less noise in this newsgroup but it would also mean that you would be
> killfiling almost every poster in this newsgroup. Perhaps you should
> simply stop posting here instead?
>
> /Leigh
>

Why should I killfile everyone who has a moment of stupidness?
Most of these people realise their mistakes and stop making a fool of
themsleves, unlike you.


Paul 03-01-2011 07:50 PM

Re: So it has been proven
 

"Leigh Johnston" <leigh@i42.co.uk> wrote in message
news:hPCdnRwAYOYn0fDQnZ2dnUVZ8kqdnZ2d@giganews.com ...
> On 01/03/2011 19:42, Paul wrote:
>>
>> "Leigh Johnston" <leigh@i42.co.uk> wrote in message
>> news:JNmdnUHqUKYJ1fDQnZ2dnUVZ8qWdnZ2d@giganews.com ...
>>> On 01/03/2011 19:19, Paul wrote:
>>>>
>>>> "Leigh Johnston" <leigh@i42.co.uk> wrote in message
>>>> news:aLKdnRT37p6y3_DQnZ2dnUVZ8kGdnZ2d@giganews.com ...
>>>>> On 01/03/2011 18:53, Paul wrote:
>>>>>> So it has been proven that, in C++, a nonstatic member function is
>>>>>> indeed different from an ordinary function in more fundamental ways
>>>>>> than
>>>>>> simply calling syntax.
>>>>>
>>>>> You have failed to prove anything whatsoever.
>>>>>
>>>>>>
>>>>>> I see most of the original arguers dropped out of the argument and
>>>>>> those
>>>>>> that persued their argument have since quietly slipped away.
>>>>>
>>>>> If any have slipped away then it is probably due to them being fed up
>>>>> with your tedious, repetitive incorrect posts and your inability to
>>>>> accept your mistakes.
>>>>>
>>>>>>
>>>>>> I guess its not important enough to those people but I always
>>>>>> considered
>>>>>> it important to understand the basics.
>>>>>
>>>>> The basics:
>>>>>
>>>>> In C++ a member function is a member of a class not a member of an
>>>>> object.
>>>>>
>>>>> HTH.
>>>>>
>>>>> /Leigh
>>>>
>>>> Leigh I have already requested that you stop replying to my posts , I
>>>> don't want to be nasty but that is all you seem to provoke. You have no
>>>> intelligence and I feel sorry for you. Go away unless you can produce
>>>> some reasonably intelligent conversation.
>>>>
>>>
>>> Please feel free to killfile those with whom you disagree; it would
>>> mean a lot less noise in this newsgroup but it would also mean that
>>> you would be killfiling almost every poster in this newsgroup. Perhaps
>>> you should simply stop posting here instead?
>>>
>>> /Leigh
>>>

>> Why should I killfile everyone who has a moment of stupidness?
>> Most of these people realise their mistakes and stop making a fool of
>> themsleves, unlike you.

>
> I have been wrong in this newsgroup a few times (I am only human) and I
> have publicly admitted my mistakes; I have yet to see you do likewise.
>
> /Leigh
>

You have been proven an idiot.


Marcel Müller 03-01-2011 08:17 PM

Re: So it has been proven
 
Paul wrote:
> So it has been proven that, in C++, a nonstatic member function is
> indeed different from an ordinary function in more fundamental ways than
> simply calling syntax.


In the C++ language: yes.
In common implementations: no.

But the handling of virtual functions and member function pointers adds
a new dimension of complexity. This does not apply to the implementation
of a member function itself, but to the implementation of member
function pointers. So sizeof(MemberFunctionPointer) is in general larger
or same than sizeof(FunctionPointer).

The calling convention is usually the same for void A::foo() and
void bar(A*). However, dereferencing void (A::*)() and void (*)(A*) is
in general a different story, since the really called method also
depends on the object type used to dereference the member function pointer.


Marcel

Paul 03-01-2011 08:56 PM

Re: So it has been proven
 

"Marcel Müller" <news.5.maazl@spamgourmet.org> wrote in message
news:4d6d545d$0$6980$9b4e6d93@newsspool4.arcor-online.net...
> Paul wrote:
>> So it has been proven that, in C++, a nonstatic member function is indeed
>> different from an ordinary function in more fundamental ways than simply
>> calling syntax.

>
> In the C++ language: yes.
> In common implementations: no.
>
> But the handling of virtual functions and member function pointers adds a
> new dimension of complexity. This does not apply to the implementation of
> a member function itself, but to the implementation of member function
> pointers. So sizeof(MemberFunctionPointer) is in general larger or same
> than sizeof(FunctionPointer).
>
> The calling convention is usually the same for void A::foo() and
> void bar(A*). However, dereferencing void (A::*)() and void (*)(A*) is in
> general a different story, since the really called method also depends on
> the object type used to dereference the member function pointer.
>
>

Seems like a fair assessment.
Also note that (A::*)() can only call itself with objects of type A or in a
derived heirarchy containing A. (*)(A*) does not have this restraint as the
pointer parameter can theoretically point to any type of object. Thus the
possibility of a different sequence of execution arises.

Example , the following ordinary_function cannot be done with (A::*)():

#include <iostream>
class Animal{public:
virtual void eat(){std::cout<< "Animal Eating"<< std::endl;}
virtual int getID()=0;
static int count;
};
class Dog: public Animal{
public:
void eat(){std::cout<< "Dog Eating"<< std::endl;}
int getID(){return 1;}
};
class Cat: public Animal{
public:
void eat(){std::cout<< "Cat Eating"<< std::endl;}
int getID(){return 0;}
};
int Animal::count =10;

Dog* overwriteCat(Animal* ptr){
delete ptr;
Dog* p = reinterpret_cast<Dog*>(ptr);
p = new Dog;
return p;
}

Cat* overwriteDog(Animal* ptr){
delete ptr;
Cat* p = reinterpret_cast<Cat*>(ptr);
p = new Cat;
return p;
}


void ordinary_function(Animal* obj){
Animal::count--;
std::cout<<"Address of obj: " <<obj << " ";
obj->eat();
if(obj->getID()){overwriteDog(obj);}
else {overwriteCat(obj);}
if(Animal::count){
ordinary_function(obj);
}
}

int main()
{
Cat* p_cat = new Cat;
Animal* p_anim = p_cat;

ordinary_function(p_cat);
}





Rolf Magnus 03-02-2011 06:41 AM

Re: So it has been proven
 
Paul wrote:

> I see most of the original arguers dropped out of the argument and those
> that persued their argument have since quietly slipped away.


Yes, that's because everything has been said multiple times already. You
opening new threads about the same topic over and over and over again won't
magically produce more arguments. So it shouldn't be much of a surprise that
people stop discussing it.


gwowen 03-02-2011 08:00 AM

Re: So it has been proven
 
On Mar 1, 8:56*pm, "Paul" <pchris...@yahoo.co.uk> wrote:
> Seems like a fair assessment.
> Also note that (A::*)() can only call itself with objects of type A or ina
> derived heirarchy containing A.


Unless you use a cast. If you subvert the type system, you can do
what the hell you want.

>(*)(A*) does not have this restraint as the
> pointer parameter can theoretically point to any type of object.


Only if you use a cast. If you subvert the type system, you can do
what the hell you want.

Juha Nieminen 03-02-2011 09:33 AM

Re: So it has been proven
 
Paul <pchristor@yahoo.co.uk> wrote:
> So it has been proven that, in C++, a nonstatic member function is indeed
> different from an ordinary function in more fundamental ways than simply
> calling syntax.


I really think you should see a doctor because you have a severe
case of OCD.


itaj sherman 03-02-2011 11:20 AM

Re: So it has been proven
 
On Mar 2, 11:33*am, Juha Nieminen <nos...@thanks.invalid> wrote:
> Paul <pchris...@yahoo.co.uk> wrote:
> > So it has been proven that, in C++, a nonstatic member function is indeed
> > different from an ordinary function in more fundamental ways than simply
> > calling syntax.

>
> * I really think you should see a doctor because you have a severe
> case of OCD.


Also his troll is wounded.
Don't waste your time on that.


All times are GMT. The time now is 07:51 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57