3 ms·
Well, being a C++ programmer for years who really would not mind going back to C++. Yes, these are known things. When one wants to call atoi, one has to know th
by cjfd 4y ago
Well, being a C++ programmer for years who really would not mind going back to C++. Yes, these are known things. When one wants to call atoi, one has to know that either the string is zero terminated or that non-numerical characters follow the numerical ones... Same kind of thing with pop_back. I would not know that calling pop_back on an empty container is undefined behaviour by heart but I would be suspicious enough that it might be to check the docs to find out.
- roelschroeven 4y agoPutting string data in a vector<char> for starters is a big code smell. If you do, you're not using the language and the standard library the way they are supposed to be used and it's on you to make sure you do everything right. Then combining that with C-style string handling functions, without taking all the extra care, is just asking for trouble IMO.