Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > So it has been proven

Reply
Thread Tools

So it has been proven

 
 
Paul
Guest
Posts: n/a
 
      03-01-2011
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.


 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      03-01-2011

"Leigh Johnston" <> wrote in message
news: ...
> 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.

..

 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      03-01-2011

"Leigh Johnston" <> wrote in message
news: ...
> On 01/03/2011 19:19, Paul wrote:
>>
>> "Leigh Johnston" <> wrote in message
>> news: ...
>>> 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.

 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      03-01-2011

"Leigh Johnston" <> wrote in message
news: ...
> On 01/03/2011 19:42, Paul wrote:
>>
>> "Leigh Johnston" <> wrote in message
>> news: ...
>>> On 01/03/2011 19:19, Paul wrote:
>>>>
>>>> "Leigh Johnston" <> wrote in message
>>>> news: ...
>>>>> 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.

 
Reply With Quote
 
Marcel Müller
Guest
Posts: n/a
 
      03-01-2011
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
 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      03-01-2011

"Marcel Müller" <> wrote in message
news:4d6d545d$0$6980$...
> 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);
}




 
Reply With Quote
 
Rolf Magnus
Guest
Posts: n/a
 
      03-02-2011
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.

 
Reply With Quote
 
gwowen
Guest
Posts: n/a
 
      03-02-2011
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.
 
Reply With Quote
 
Juha Nieminen
Guest
Posts: n/a
 
      03-02-2011
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.


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

 
Reply With Quote
 
itaj sherman
Guest
Posts: n/a
 
      03-02-2011
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
THIS WORKS - IT'S BEEN PROVEN! LET'S MAKE THIS HAPPEN! Arm7 C++ 1 08-28-2008 01:19 PM
The printing has been stopped and this job has been add to the queu? dejola Computer Support 6 12-30-2005 03:26 AM
I need help I has been over 6 months since I've been able to do the system check for updates Marc Computer Support 8 07-25-2005 07:04 PM
TRUE PROVEN METHOD OF HIGHER INTELLGENCE zetasum Java 2 02-28-2005 02:25 AM
PROVEN third party dropdown control needed David C ASP .Net 0 12-15-2004 05:19 PM



Advertisments
 



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