The 2024 Wheel Reinvention Jam is in 16 days. September 23-29, 2024. More info

memory initialization in GUAR

I've noticed that in the game update is always a check for memory initialization. I believe it's to simplify the platform code.

The question is: is that initialization going to be in another place for shipping? and save an IF in the game update?

Cheers!

Edited by David Roguin on
It'll probably stay there. It is a perfectly predicted branch (it's ALWAYS false every time after the first), so it's almost literally free in the context of the game code, so it's not worth making a separate function that has to get exposed to the platform layer.

Getting rid of "if" statements is more something you think about when you're inside a loop or recursion, where you know you are going to be executing hundreds or thousands of them.

- Casey
Thanks a lot!
Even though it might not cost anything at runtime, why would you want this initialization logic there?
It simplifies the creation of other platform implementations by only calling one function and it allows the hot reloading technique to be uber simple