Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取枚举名代码不适用于clang+msvc #21

Open
weypro opened this issue Jul 11, 2023 · 0 comments
Open

获取枚举名代码不适用于clang+msvc #21

weypro opened this issue Jul 11, 2023 · 0 comments

Comments

@weypro
Copy link

weypro commented Jul 11, 2023

以下代码不适用于clang15+msvc(vs2022)的情形

#if defined(_MSC_VER)
			size_t pos = s.find(',');
			pos += 1;
			size_t pos2 = s.find('>', pos);
#else

在执行这一段前,s的值为:"const char *__cdecl 函数名 [T = 枚举, N = 枚举::枚举常量]"
我现在改为以下代码可以正常使用:

#if defined(_MSC_VER) && !defined(__clang__)
			size_t pos = s.find(',');
			pos += 1;
			size_t pos2 = s.find('>', pos);
#elif defined(__clang__)
            size_t pos = s.find("N = ");
            pos += 1;
            size_t pos2 = s.find(']', pos);
#else
			size_t pos = s.find("N = ");
			pos += 4;
			size_t pos2 = s.find_first_of(";]", pos);
#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

No branches or pull requests

1 participant