PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

A very basic compiler question

All throughout my code I have to make a horizontal and vertical adjustment to the coorindates I blit to. The way I've done this is simply to have two variables, xadj and yadj, and I add them to the X/Y coordinates I'm going to blit to any time I do a blit, like so:

doBlit(xadj + 25, yadj + 25, myImage);

My question, which I know is very basic yet I'm not 100% certain of the answer is this...

If I replace my xadj and yadj variables with defines, then the addition in the case of literals like the above will be done at compile-time rather than runtime, correct?

Ok, stop laughing and answer me! :) Seriously though, I've never had a reason to think about it, so I'm not sure (although I believe what I've written to be the case). Just wanted to verify or get a correction. Thanks all!
Yes, the precompiler will do just as you described.

Dan East
Supposedly, it will work with a 'const' as well...
Cool! That was one of those times where you know you know the answer, but you also know that if you don't know for sure taht you know, it's going to come back and bite you.

Uhhh... WHAT?!?

Seriously though, thanks!