Should global variables be pointers or full objects?

Posts: 49
Joined: 2006.07
Post: #1
Apple's docs recommend not to make any large classes global variables, so that they don't slow down the application launching time. They recommend using pointers that start out as NULL instead and then load the objects onto the heap as needed. I am wondering if that is really the best idea for games. I am new to game programming (though not to programming in general) and I've never had to worry about performance issues a lot before, so I don't have much of a feel for this, but isn't it going to slow the game down a lot if every other line of code requires a pointer trace? Or are pointer traces fast enough that it doesn't really matter?
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
I wouldn't worry about this kind of optimization at all... other things are far more likely to cause you speed problems than having large globals or not. Do what's easiest.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  C: Global Variables versus Parameters Lizard Man 10 12,640 Jan 13, 2010 08:22 PM
Last Post: Lizard Man
  Accessing an inherited class's variables Tobs_ 22 18,782 Feb 28, 2007 05:26 PM
Last Post: mac_girl
  Thread-Safe reference counted smart pointers in c++ JeroMiya 1 4,550 Nov 21, 2006 12:28 PM
Last Post: OneSadCookie
  Problems with variables in Obj-C vnvrymdreglage 16 12,923 Oct 2, 2006 10:19 PM
Last Post: vnvrymdreglage
  where do global variables fall into the memory type? WhatMeWorry 3 4,703 Jun 5, 2006 02:45 PM
Last Post: OneSadCookie