Recently I did a batch of interviews for three positions in my team, and part of my standard interview is a coding question. I tend to focus on problems that will take at most 50% of the time I have, so the ideal question for me is apparently easy, but hides a much better solution …

Continue reading The Coding Interview

I begun to write this two years ago at the beginning of the pandemic, but then forgot to read, and hit publish. I think today is a good day to update, clean up, and publish. You might not be stranded at home anymore, but I think most of the things I wrote are still valid, …

Continue reading On studying C++

This code has been compiling for the last several years, despite the fact we have the perfect tool to make this foolish code stop compiling. Adding an ampersand at the end of every copy-assignment and move-assignment operator (or operators of the form <op>=). Why isn’t this best practice already? Or if it is, why isn’t …

Continue reading Should this stop compiling?

Updated on 2019/07/03 (long overdue) after this thread on reddit. My post from last week contained a HUGE bug: optionals don’t move their content lose their value on move, so destructor on moved handles is still invoked (thus causing multiple destructions). In the brief discussion on reddit, I proposed to create a optional with move …

Continue reading Moveable optional, really?

Last Saturday I’ve been giving two presentations about C++11&14 I originally wrote for NVIDIA internal tech talk at C++ User Group in Udine meetup, invited by Nicola Gigante (@gignico). It has been a very nice meetup, with a lot of nice people, and I’m willing to join them again in the future, if possible. During the first one, …

Continue reading LSIL,TTNG (Last Saturday I Learned, Thanks to Nicola Gigante…)

Note to self: Never try to modify your examples in realtime during a presentation, to show an idea that just came through your mind: You might succeed. The problem We have an old pre-C++11 class: class C { string _s; public: C(const string &s) : _s(s) {} const string &get() const { return _s; } …

Continue reading Optimizing return values