🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #771

Fast acces to class method

#771
From: dataman
Date: Wed, 22 Mar 2000 00:00
42 lines
1915 bytes
What is the fastest way for  accessing a member  in  a class.

DATA is a structure;

class A
{
  public:
            //directly by having access to the member ?
            DATA data;

            //by return value
            DATA GetData()
            {
              return data;
            }

           //by reference
           void GetData(DATA& d)
           {
              d=data;
           }

           //by pointer
           void GetData(DATA* pD)
           {
            *pData=data;
           }
}

I am programing a real time application (a 3D game) , that access very
often the DATA (several times per second) in the class A .
So, i need the fastest access to it , even if the OOP may suffer (like
accessing directly DATA without  a method) .

You can give me the + and - of every method (speed , memory ..etc.) , so
i can have a best look.

Thank you.

--
The Aero Section : http://fly.to/TheAeroSection/
The Aero Section is a large military aircraft photo gallery.
Technical Details
Message-ID: <38D8E693.34731AA0@cyberdude.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fdcad,d558f056865fc0f1,start
X-Google-Attributes: gidfdcad,public
X-Google-Thread: 114592,d558f056865fc0f1,start
X-Google-Attributes: gid114592,public
X-Google-Thread: 109fba,d558f056865fc0f1,start
X-Google-Attributes: gid109fba,public
From: dataman@cyberdude.com
Subject: Fast acces to class method
Date: 2000/03/22
Message-ID: <38D8E693.34731AA0@cyberdude.com>
X-Deja-AN: 600883450
Content-Transfer-Encoding: 7bit
X-Accept-Language: fr,en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@sunrise.ch
X-Trace: news1.sunrise.ch 953738858 636 194.230.190.150 (22 Mar 2000 15:27:38 GMT)
Organization: sunrise communications ag
Mime-Version: 1.0
Reply-To: dataman@cyberdude.com
NNTP-Posting-Date: 22 Mar 2000 15:27:38 GMT
Newsgroups: alt.comp.lang.learn.c-c++,comp.lang.c++,fr.comp.lang.c++