C++ edge cases and various other stupid things