在GNU编译器下根据系统预置宏,正确识别是否支持char8_t。(注:仅根据文档实现,待LINUX下测试)
This commit is contained in:
@@ -34,11 +34,12 @@ namespace hgl
|
|||||||
std::cout<<(char *)str.c_str()<<std::endl;
|
std::cout<<(char *)str.c_str()<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 对于不支持C++20的编译器还得用宏处理一下
|
#ifdef HGL_SUPPORT_CHAR8_T
|
||||||
// inline void Log(LogLevel ll,const AnsiString &str)
|
inline void Log(LogLevel ll,const AnsiString &str)
|
||||||
// {
|
{
|
||||||
// std::cout<<str.c_str()<<std::endl;
|
std::cout<<str.c_str()<<std::endl;
|
||||||
// }
|
}
|
||||||
|
#endif//HGL_SUPPORT_CHAR8_T
|
||||||
|
|
||||||
inline void DebugLog(LogLevel ll,const UTF16String &str,const char *filename,int line,const char *funcname)
|
inline void DebugLog(LogLevel ll,const UTF16String &str,const char *filename,int line,const char *funcname)
|
||||||
{
|
{
|
||||||
|
@@ -17,5 +17,12 @@ namespace hgl
|
|||||||
|
|
||||||
using float32 =float;
|
using float32 =float;
|
||||||
using float64 =double;
|
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
|
}//namespace hgl
|
||||||
#endif//HGL_DATATYPE_GNU_INCLUDE
|
#endif//HGL_DATATYPE_GNU_INCLUDE
|
||||||
|
@@ -72,14 +72,6 @@
|
|||||||
|
|
||||||
#endif//__GNUC__
|
#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_THREAD_LOCAL_STORAGE __thread //线程本地储存
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
#define HGL_LIB_FRONT HGL_LIB_OS "_" HGL_LIB_COMPILER_NAME "_" HGL_LIB_DEBUG_NAME "_"
|
#define HGL_LIB_FRONT HGL_LIB_OS "_" HGL_LIB_COMPILER_NAME "_" HGL_LIB_DEBUG_NAME "_"
|
||||||
|
@@ -21,9 +21,10 @@
|
|||||||
#define HGL_THREAD_LOCAL_STORAGE __declspec(thread) //线程本地储存
|
#define HGL_THREAD_LOCAL_STORAGE __declspec(thread) //线程本地储存
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
#if _MSVC_LANG>=201704L //C++20
|
#if _MSVC_LANG>=201704L //C++20
|
||||||
using u8char =char8_t;
|
#define HGL_SUPPORT_CHAR8_T
|
||||||
|
using u8char =char8_t;
|
||||||
#else
|
#else
|
||||||
using u8char =char;
|
using u8char =char;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HGL_FMT_I64 "%I64d"
|
#define HGL_FMT_I64 "%I64d"
|
||||||
|
Reference in New Issue
Block a user