News for hackers. Stuff that matters.
Re:C++23: The Next C++ Standard by spacechild1 on Tuesday July 11, 2023 @04:00PM (#36686497)
> rather it relies on making new objects constantly, whereas with explicit functions, you can pass in an additional parameter that will take the result.

We have move semantics since C++11.

Re:C++23: The Next C++ Standard by gpderetta on Tuesday July 11, 2023 @05:34PM (#36687524)
And expression templates even before that.
Re:C++23: The Next C++ Standard by dryanau on Wednesday July 12, 2023 @12:29AM (#36690485)
It's not the same if you need to allocate memory for the result. If you could pass the result in by reference, then you could (re)use a buffer which has already been allocated. The difference is massive in things like matrix calculations or image processing where you have an inner loop or a real-time stream repeating similar calculations.
Re:C++23: The Next C++ Standard by bhouston on Wednesday July 12, 2023 @06:31AM (#36692562)
Or you are working with a language like JavaScript where math primitives are GC objects and thus quite costly. In those languages if you do not reduce object creation via reuse in this way, it can be very slow.