-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Unify all Windows build configuration on the same CharacterSet #888
Comments
Multibyte is obsolete, Unicode is the right way to go. |
Unicode is multi-byte. Unicode encoded as UTF-8 is variable length multi-byte at that. |
@madler: Can you look this issue? |
This is mostly correct, yet shows zero experience with Visual Studio and Windows. |
According to this https://devblogs.microsoft.com/cppblog/mfc-support-for-mbcs-deprecated-in-visual-studio-2013/ it looks like they later undeprecated it, but still recommend Unicode for new code bases. Also, PowerShell team seems to be using Multibyte for their rebuild of ZLib https://github.com/PowerShell/ZLib/blob/20ce7b065269cda22beb1cd9ecc450be5ea99b8f/build/zlib.vcxproj#L56 most notably used by their OpenSSH fork. I don't think they would be using it if it would be completely deprecated. Any downstream would be able to change the settings to match their specific needs in the rebuild. So, if it will be Unicode across the board for all projects it should be just fine. |
Does this choice make any difference at all in the compiled zlib code? I believe that zlib does not use any types or functions that change their nature depending on Unicode vs. MultiByte. There is only explcit use of the wide character type and associated functions for |
It was repeated twice that the warning would be removed. |
Never had reasons to look at this part of the library because compression and decompression code do not depend on character width choice, and it worked well for me with Unicode. Line 206 in 88ec246
Copy of wchar_t string to char string usually would be the first character only, because second byte is null.
Another issue is Unix-ism 0666 Line 233 in 88ec246
By some luck this value includes desired flags, but properly it should be _S_IREAD | _S_IWRITE for read and write access.
Also, there are peculiarities when using In conclusion it might be said that conversion to Unicode is desirable, but cannot be done by simple substitution of parameters in VS projects. |
The question was "Does this choice make any difference at all in the compiled zlib code?" To be explicit, do any of the bits in the resulting library differ if I change It's those Neither
A Unicode open function in zlib is already provided by |
Actually, I have plenty of experience with this. I even benchmarked an application that did a lot string process about 20 years ago and found building for Unicode was slower. It seems the conversion in the all the "A" functions in the Win32 API is less expensive than doubling the size of all your strings with mostly null bytes. Of course, if zlib only uses Looking at @madler 's comment, I'm wondering if defining Unicode is necessary at all, and also, what problem occurs if you don't define this? |
In any case, convertion to multi-byte string was not necessary.
This also sets |
Right now there are cases, when configuration sets Multibyte
zlib/contrib/vstudio/vc17/miniunz.vcxproj
Line 45 in 643e17b
zlib/contrib/vstudio/vc17/miniunz.vcxproj
Line 50 in 643e17b
zlib/contrib/vstudio/vc17/zlibstat.vcxproj
Line 72 in 643e17b
The text was updated successfully, but these errors were encountered: