Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Mauzoleum

Performance question

This topic is 5728 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I am writing 3D application and i will need vectors. Now i have:
      
struct stVector
{
float x;
float y;
float z;
}
  
but i want do do classes like
        
class cVector
{
public:
float x;
float y;
float z;

cVector();
~cVector();
void Normalize(void);
};
  
Now if i declarate vector i for example write "float Pos=Vector.x" it will be faster for structure/class or maybe it will be exacly the same performance? Thank you for your answers. [edited by - Mauzoleum on January 18, 2003 9:18:31 PM] [edited by - Mauzoleum on January 18, 2003 9:19:50 PM]

Share this post


Link to post
Share on other sites
Advertisement
Go with the class. They are the same speed, and the same size in memory (unless you have virtual functions).


Only use structs if you don''t need to have any functions/constructors/destructors.

(That last bit is just my opinion though.)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!