-
Notifications
You must be signed in to change notification settings - Fork 543
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
improve compatibility for _MSC_VER #514
base: master
Are you sure you want to change the base?
Conversation
copy from lexxmark/winflexbison@2a7586a by @yjh-styx - partial work on westes#367
I think this missed a check that MSVC compiles code only for little-endian machines. Otherwise the semantic would be wrong. |
Update: I think it would be good enough to cite this in the code comments |
So you suggest to make those macros a no-op, right? |
@GitMensch No. The byte order does need to be swapped for little endian. What I meant is add a comment that MSVC only supports little endian platforms and you have the macros defined the way you did them. #ifdef _MSC_VER
/* MSVC only supports little endian.
(https://learn.microsoft.com/en-us/cpp/standard-library/bit-enum?view=msvc-170) */
#include <stdlib.h>
#define htonl(n) _byteswap_ulong(n)
#define htons(n) _byteswap_ushort(n)
#endif |
I see, thanks for the clarification. |
@Explorer09 you can use GitHub's code suggestion feature, then @GitMensch can apply the changes with a few clicks and you get credits :) |
I was expecting that @GitMensch adjust the formatting of my suggested change instead of applying the changes as is. |
If someone wants to implement @xplorer09's suggestion (with whatever else MS stuff needs to be done inside the ifdef), I would merge it. |
copy from lexxmark/winflexbison@2a7586a by @yjh-styx - partial work on #367