camelCase
The Case of the Mysterious Camel.
- Reaction score
- 362
I didn't know how to best title this thread but it's just a silly question that popped up in my head.
I've been working on the framework for my game for a bit and recently re-wrote the entire Unit class (which is huge).
Anyways, within the class method definitions, should I use the accessors in them or just directly access it?
Like this:
Versus. this:
Is one faster than the other?
(I would think that the one filled with function calls is slower, right?)
I've been working on the framework for my game for a bit and recently re-wrote the entire Unit class (which is huge).
Anyways, within the class method definitions, should I use the accessors in them or just directly access it?
Like this:
Code:
void someClass::someMethod () {
int i = getSomething();
//Some stuff
setSomethingAwful(getSomethingElse()*i+getSomethingElseEntirely());
}
Versus. this:
Code:
void someClass::someMethod () {
int i = something;
//Some stuff
somethingAwful = somethingElse * i + somethingElseEntirely;
}
Is one faster than the other?
(I would think that the one filled with function calls is slower, right?)