Am Wed, 3 Jan 2018 10:57:13 -0800 schrieb Ali Çehreli <acehr...@yahoo.com>:
> On 01/03/2018 10:40 AM, Patrick Schluter wrote: > > On Tuesday, 2 January 2018 at 23:27:22 UTC, H. S. Teoh wrote: > >> > >> When it comes to optimization, there are 3 rules: profile, profile, > >> profile. I used to heavily hand-"optimize" my code a lot (I come from > >> a strong C/C++ background -- premature optimization seems to be a > >> common malady among us in that crowd). > > > > That's why I always tell that C++ is premature optimization oriented > > programming, aka as POOP. > > […] > > That's why I like producer functions that return values: > > vector<int> makeInts(some param) { > // ... > } > > And if they can be 'pure', D allows them to be used to initialize > immutable variables as well. Pretty cool! :) > > Ali May I add, this is also optimal performance-wise. The result variable will be allocated on the caller stack and the callee writes directly to it. So even POOPs like me, do it. -- Marco