Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Long day.

Sign in to follow this  


Well work is tiring but I have started taking my C++ books to work and reading them on breaks. I have gotten to understand pointers a lot better which Iam glad for because i remember reading somewhere that passing pointers to functions instead of the actual type is faster cus it transfers 1byte instead of 4(for a int). Iam going to try and find that again and clarify it.

Anyway work goes as normal on Engine. slow until works over but Iam trying to get some done. Still havent had time to actually tackle the coding of my event system. thinking about how exactly i want to do it. I think iam going to read through all of the SDL docs for events this weekend and then go from there. well take it easy eveyrone
Sign in to follow this  

1 Comment

Recommended Comments

Not quite. A pointer should be 32 bits, and therefore 4 bytes. (On a 32 bit system. 64 bits on a 64 bit system.) The reason it's better to pass by pointers is that you won't make a copy of the entire object. This is great if you have a big struct or class. Here's an example:

#include <stdio.h>

struct BigStruct
int foobar[2000];

int main()
printf("%d\n", sizeof(int*));
printf("%d\n", sizeof(BigStruct));
printf("%d\n", sizeof(BigStruct*));
return 0;


In C++, instead of passing by pointers, you'll probably want to use references.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!