Fix flag addition, set them specifically for gcc
Switch to using numeric_limits