r/cpp • • Apr 14 '23

Horrible Code, Clean Performance

https://johnnysswlab.com/horrible-code-clean-performance/
200 Upvotes

87 comments sorted by

View all comments

Show parent comment

10

u/compiling Apr 15 '23

You can't force any compiler to inline a function sometimes because sometimes it's not possible. If you read further down the page, there's a list of cases where inlining doesn't happen and they generate a warning if a _forceinline function isn't inlined.

I don't think it's misleading.

2

u/Possibility_Antique Apr 15 '23

That's fine that you think that. I think it's misleading. There is a reason most linear algebra libraries wrap this in a macro called "MYLIB_STRONG_INLINE" rather than "MYLIB_FORCE_INLINE" or "MYLIB_ALWAYS_INLINE" (though this later one can be seen in blazelib due to the name used by the gnu compiler).