在 2026-6-12 04:02, Luca Bacci 写道:
> In C, if a function is defined `static inline` then it will not be callable from a user-defined inline function with external linkageVery intersting! Didn't know that. Windows SDK also defines Interlocked functions in winnt.h as inline with external linkage. I guess we should continue doing the same, then :)
MSVC seems to implement `__inline` as C++ inline, with vague linkage. (not sure about `inline`)
> Is there a reason why someone wants to do that? Why would someone want to declare a function whose name is known to be reserved and compiler-specific?Don't know, but winnt.h from Windows SDK does that: #include <Windows.h> #ifdef __INTRIN_H_ #error "intrin.h included" #endifWell, actually it depends on that target architecture. It compiles fine on x86 and x64, but fails on ARM64. Perhaps users want to use some intrinsics but don't want to bring all of intrin.h in the global namespace (quite questionable if you ask me!)
I don't get your point. Microsoft winnt.h has a dependency on non-builtin target-identification macros such as `_AMD64_` which are defined by windows.h, so including winnt.h without windows.h causes errors like `"No Target Architecture"`. On the other hand, windows.h includes winnt.h so there's no point to include it again.
-- Best regards, LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
