Re: c-style string vs std::string
"Christopher" <cpisz@austin.rr.com>
I am growing really tired of having to decypher 1000 functions that
were written to do simple operations on c-style strings that I could
do in 50 lines with streams and std::strings. My peer uses that same
old ,"Its more efficient " argument that I always hear. In fact, that
argument has grown into ,"we shouldn't use any of the STL containers,
because they allocate, which is expensive."
For example, I had to debug through 1500 lines today, that simply
replaced a token in a char * with another char *, because everything
to search for the token, convert characters to digits, check for
digits or alpha characters, shift things to make room, replace
elements, etc was all manually written. I could have done this easily
with a find and replace call from the STL .
Well, I am tired of it. I want to write a test and profile it. One
operation at a time. I am sure the differences are negligable,
especially when wieghing in the maintainability of the code.
Tired of bullshit? So quit and find a proper place to work, one that aligns
with your values.
There is no point wasting time on experiments or "proof" or anything -- a
shop with the described mentality is way beyond repair.
Before I start spending time to disprove what hasn't even been proven,
I want to check if anyone has had to do this and has preexisiting
code? Or if anyone knows a reliable resource where I can get some,
instead of writing it from scratch? Also, any advice on how to write
such a test without having any points in it that could void the
results would be useful.
I don't get your questions. You have the baseline. You have alternative in
your head. So cde the alternative version, run the unit tests to prove the
behavior is the same, then measure the peroformance -- or rather make the
opposition measure it for you proving the "inefficiency".