在 2019/4/5 下午8:07, Jacek Caban 写道:
> On 4/5/19 9:15 AM, Martin Storsjö wrote:
> 
> It would be great to have __forceinline fixed. I've seen a problems in
> code using static __forceinline multiple times. I also recall that
> attempts to change that had their problems, so it's more tricky than it
> seems (if possible).
> 

The `extern` specifier is required in the case of C (but is not in C++)
because plain `inline` is not the same thing with `extern inline` [1].

When compiled as C++, `extern` has no effect on an `inline` function. If
the entire function body is inlined then no external definition is
emitted; otherwise a weak definition is emitted, so taking the address
of an inline function in all translate units returns the same value, and
no multiple definition errors may occur. I haven't heard of such a thing
in C89 mode; it could be achieved by using the `weak` or `selectany`
attribute with C99 `extern inline` semantics, anyway.


[1] https://en.cppreference.com/w/c/language/inline

> 
> How about doing things in msvc ucrt compatible way? Like the patch I
> attached as an example (not yet tested)?
> 
> 
> Jacek
> 
> 
> 


-- 
Best regards,
LH_Mouse

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to