在GNU编译器下根据系统预置宏,正确识别是否支持char8_t。(注:仅根据文档实现,待LINUX下测试)

This commit is contained in:
2020-07-11 16:13:19 +08:00
parent 50aa9ce555
commit 9191dcb73c
4 changed files with 16 additions and 15 deletions

View File

@@ -17,5 +17,12 @@ namespace hgl
using float32 =float;
using float64 =double;
#if defined(__cpp_char8_t)||defined(__cpp_lib_char8_t)
#define HGL_SUPPORT_CHAR8_T
using u8char = char8_t;
#else
using u8char = char;
#endif
}//namespace hgl
#endif//HGL_DATATYPE_GNU_INCLUDE

View File

@@ -72,14 +72,6 @@
#endif//__GNUC__
// 假设 GCC 从 11 开始正式支持 char8_t( 这个我手头没有 11 ,不确定 )
#if __GNUC__ >= 11
using u8char = char8_t;
#else
using u8char = char;
#endif
#define HGL_THREAD_LOCAL_STORAGE __thread //线程本地储存
//--------------------------------------------------------------------------------------------------
#define HGL_LIB_FRONT HGL_LIB_OS "_" HGL_LIB_COMPILER_NAME "_" HGL_LIB_DEBUG_NAME "_"

View File

@@ -21,9 +21,10 @@
#define HGL_THREAD_LOCAL_STORAGE __declspec(thread) //线程本地储存
//--------------------------------------------------------------------------------------------------
#if _MSVC_LANG>=201704L //C++20
using u8char =char8_t;
#define HGL_SUPPORT_CHAR8_T
using u8char =char8_t;
#else
using u8char =char;
using u8char =char;
#endif
#define HGL_FMT_I64 "%I64d"