Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

__cplusplus in MSVC is always 199711L #134

Open
Leopard20 opened this issue Nov 6, 2021 · 2 comments
Open

__cplusplus in MSVC is always 199711L #134

Leopard20 opened this issue Nov 6, 2021 · 2 comments

Comments

@Leopard20
Copy link

Leopard20 commented Nov 6, 2021

Hi. I recently realized that MSVC always sets __cplusplus to 199711L unless /Zc:__cplusplus is enabled:
https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-160&viewFallbackFrom=vs-2017

Since you use this macro in your code, I figured I should ask whether it matters in terms of performance:

#if __cplusplus >= 201703L

#define ROBIN_HOOD_PRIVATE_DEFINITION_CXX() __cplusplus

For now I just replaced the macro with a custom macro I wrote myself so that it uses the latest compiler features.

@martinus
Copy link
Owner

martinus commented Nov 7, 2021

This only enables the ability to use std::string_view as key in a hashmap. So it's not a performance issue but one feature could be disabled

@harayuu9
Copy link

Hi. I think it is better to use __cplusplus and _MSVC_LANG together in MSVC environment.
(This is only available in Visual Studio 2015 or later, but _MSVC_LANG returns the correct value in the standard configuration.

https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants