Skip to content

Make GameInput c++98 compatible - #41

Open
madebr wants to merge 1 commit into
microsoftconnect:mainfrom
madebr:add-c++98-compatibility
Open

Make GameInput c++98 compatible#41
madebr wants to merge 1 commit into
microsoftconnect:mainfrom
madebr:add-c++98-compatibility

Conversation

@madebr

@madebr madebr commented Jul 28, 2026

Copy link
Copy Markdown

With a few small changes to lib/GameInput.cpp, it can be made c++98-compatible.
This is useful for SDL to keep compatibility with toolchains that support the standards of the late nineties (c99/c++98).

I verified this change by using the following CMakeLists.txt, and configuring with -DCMAKE_CXX_STANDARD=98.

cmake_minimum_required(VERSION 3.20)
project(GameInput CXX)

if(NOT WIN32)
    message(FATAL_ERROR "Invalid platform")
endif()

add_library(gameinput STATIC lib/GameInput.cpp)
target_compile_definitions(gameinput PRIVATE _UNICODE UNICODE)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|IntelLLVM")
    # Avoid a dependency on libstdc++-X.dll for `__gxx_personality_seh0`
    include(CheckCXXCompilerFlag)
    check_cxx_compiler_flag(-fno-exceptions CXX_COMPILER_SUPPORTS_FNO_EXCEPTIONS)
    if(CXX_COMPILER_SUPPORTS_FNO_EXCEPTIONS)
        target_compile_options(gameinput PRIVATE "-fno-exceptions")
    endif()
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant