News for hackers. Stuff that matters.
Re:Leaving Go by pcwalton on Monday April 28, 2014 @01:53PM (#7661668)
> x = append(x, foo) is a common C idiom too; in fact, it's been awhile since I had to work with STL containers, but I think it was common there too.

No, vector::insert() is the common idiom and mutates in place. It'd be written `x.insert(x.end(), foo.begin(), foo.end());` For single elements, vector::push_back() is the common idiom, and also mutates in place.

Re:Leaving Go by tptacek on Monday April 28, 2014 @01:54PM (#7661677)
Hrm. I've written about 100kloc of C++ code, around ~1999-2000. I'm going to have to go figure out why I thought this was the case.
Re:Leaving Go by webkike on Monday April 28, 2014 @02:02PM (#7661743)
vector::insert() is certainly not a C idiom. In can never be a C idiom because that is C++ code. the x = append(x, foo) idiom can be seen all over C, most obviously with the use of realloc, which is often called to resize an array via x = realloc(x, newsize).
Re:Leaving Go by mjdwitt on Monday April 28, 2014 @02:18PM (#7661860)
Indeed. Which is why pcwalton is answering Thomas' conjecture about C++'s STL containers.