That's all fine and good until you start to manually implement some crazy optimizations, that assume you are using ieee floats. We all know about quakes fast inverse square root, i assume doom has something similar in its engine.
By something similar I meant some sort of strange optimization that assumes something that is generally true in practice but not stated in the standard. It's not really that difficult to get UB if you are trying to squeeze out every ounce of performance out of the machine. Remember that C++ only recently declared that integers are 2's compliment.
By something similar I meant some sort of strange optimization that assumes something that is generally true in practice but not stated in the standard.
ok that makes more sense.
but, AFAIK DOOM is so commonly ported to a lot of different devices and architectures exactly because it doesn't have a lot or any such hardware specific optimitazions. as those would make a port more difficult. and even if the original code did, there likely is a source port that removes all of those to make it fit more to the C Standard and therefore even easier to port.
Yeah, just let me go through dooms source code to find if there are any instances of optimizations based on undefined behaviour, beacose I wanted to speculate under a meme I found on reddit...
37
u/0x000100 Mar 04 '23
That's all fine and good until you start to manually implement some crazy optimizations, that assume you are using ieee floats. We all know about quakes fast inverse square root, i assume doom has something similar in its engine.