Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: OOP - Is this possible?

Author: Ratko V Tomic

Date: 15:40:57 03/27/02

Go up one level in this thread


> But actually, the 'this' pointer is implied, the complier
> _know_ it is there and it knows the specific object on
> which function is working. In C, you have to use the indirection
> operator '->' all the time.

The 'this' pointer is a pointer to an instance of the class, so
the compiler has to load and use-up a register (ecx on VC) to access
the class variables for a given instance. This C++ indirection and
the register usage is on top of any other indirection that is common
to C and C++. You would almost have to use C++ like C (e.g. not use
class instantiated variables in any time critical functions) to
avoid using-up of the register for 'this' (which on x86 processor
is expensive since it has so few registers).



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.