On 4/8/19 4:33 AM, Liu Hao wrote:
在 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.
Sure, but what does it have to do with __forceinline? __forceinline is
for functions that are really meant to be inlined and thus I think it
should not try to preserve single pointer value. With removed extern, we
leave the choice for user, one could still use extern __forceinline.
And in this particular context of time functions, we really don't want
to allow compiler/linker using the available symbol. It may be a
different variant of the function than was used by the header.
Jacek
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public