On Thu, 15 Jul 2021, Biswapriyo Nath wrote:

Question: This adds a condition for arm64 ad `#ifdef _ARM64_. It
matches with the WinSDK. Should it be replaced with __aarch64__ or
_M_ARM64_ etc.? As far as I can remember, there was a discussion like
that but forgot the end result of it.

Overall, try to match the surrounding style of the file. If there's no consistent style and/or it's standalone new code, prefer using the GCC style builtin defines like __aarch64__.

In GCC (and Clang in mingw mode), __i386__, __x86_64__, __arm__ and __aarch64__ are predefined by the compiler.

In MSVC (and Clang in MSVC mode), _M_I386, _M_AMD64, _M_ARM and _M_ARM64 are predefined by the compiler.

In mingw-w64 headers, we define the MSVC style defines in headers, together with other windows style defines like _ARM64_. Using them is a bit more brittle as it depends on having the right headers included before, to define them, while the compiler provided defines always are available. But if there's lots of other code nearby that uses a specific style, being consistent with that style is probably worth more.

// Martin



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to