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

Tricky to use with MSVC and C++20 #65

Closed
s9w opened this issue Oct 22, 2021 · 7 comments
Closed

Tricky to use with MSVC and C++20 #65

s9w opened this issue Oct 22, 2021 · 7 comments

Comments

@s9w
Copy link

s9w commented Oct 22, 2021

The example code doesn't compile with C++20 or above. The only mention of C++20 is a note to use tiny_utf8::u8string instead. That also fails to compile on MSVC at least since it's guarded by a check on __cplusplus. That macro is by default not set properly on MSVC, see https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus. Maybe that check could be rewritten in a more universal way, or at least some documentation be added about any of this.

@DuffsDevice
Copy link
Owner

Hi Sebastian, thanks for your message, I will make the adjustments to the code now :)
Cheers
Jakob

@DuffsDevice
Copy link
Owner

DuffsDevice commented Oct 27, 2021

May I ask you to check on your side, whether it works now?
I implemented it portable, so that you don't have to add the /Zc:__cplusplus option, which I just learned about ^_^

@s9w
Copy link
Author

s9w commented Oct 27, 2021

Hey, thanks for the fix. I just checked and it works now.

However on MSVC warning levels 3+, a simple u8string constructions leads to a warning here:

_BitScanReverse( &value_log2 , value );

value is an uint64_t there (8 byte) and the parameter is an unsigned long (4 byte). That is just a warning though, and technically a seperate issue.

@DuffsDevice
Copy link
Owner

DuffsDevice commented Oct 27, 2021

Super, glad to hear that! Ok, thanks for letting me now 😃
Is that fixed now by my latest commit?

@s9w
Copy link
Author

s9w commented Oct 27, 2021

Yeah just saw and tested it. Everything's beautiful. Thanks again.

@s9w s9w closed this as completed Oct 27, 2021
@DuffsDevice
Copy link
Owner

Nice 👍

@DuffsDevice
Copy link
Owner

Thanks for the bug report!

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

2 participants