News for hackers. Stuff that matters.
Re:Defining interfaces in C++ with ‘concepts’ (C++20) by wahern on Wednesday April 19, 2023 @03:17AM (#35625276)
Interface methods in Go are like virtual methods in C++. In principle C++ compilers when statically compiling everything can often remove virtual method indirection for some objects, but I think in general this optimization is still uncommon and difficult to coax out a compiler. Go definitely does not do this, even though in principle it should be easier.

Basically, "interfaces" in Go and C++ actually refer to quite different language features. (Or at least, the author is using the term to describe quite different language features.)

Re:Defining interfaces in C++ with ‘concepts’ (C++20) by pjmlp on Wednesday April 19, 2023 @04:28AM (#35625770)
This is common when doing LTO, without it there is no guarantee that there isn't some dynamically loaded code that would be broken, this is one area where JIT focused languages have an advantage.
Re:Defining interfaces in C++ with ‘concepts’ (C++20) by gpderetta on Wednesday April 19, 2023 @05:27AM (#35626134)
Indeed you need LTO for generalized devirtualization, but guarded devirtualization, static classes and final can still help even without LTO.