Hacker News new | past | comments | ask | show | jobs | submit login

Can you elaborate?



Not the original poster, but in C++ you would be using a container, likely a vector so the internal data could move, but because the container is updated the caller can be unaware.

The abstraction leaks a bit. The result of a data() or c_str() call cannot be trusted after the vector is manipulated.

When passing a vector by reference to another function you effectively get a double pointer (abstracted behind a reference and a container) so the inner one can be moved.

I'm not familiar with go, but if it is like C in this respect append would have been clearer with a double pointer and no return value.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: