Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #10206

Re: c-style string vs std::string

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: c-style string vs std::string
Date 2011-09-17 10:19 +1200
Message-ID <9di0c1Fr5dU1@mid.individual.net> (permalink)
References <4202e56b-e5f5-4b39-ba44-a4d6330affa2@n11g2000yqh.googlegroups.com>

Show all headers | View raw


On 09/17/11 10:07 AM, Christopher wrote:
> 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.

Assuming giving your peer a slap isn't an option, why don't you use your 
existing code?  Provide alternatives to the C code and compare the two. 
  That should be more convincing than an artificial benchmark.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

c-style string vs std::string Christopher <cpisz@austin.rr.com> - 2011-09-16 15:07 -0700
  Re: c-style string vs std::string Ian Collins <ian-news@hotmail.com> - 2011-09-17 10:19 +1200
    Re: c-style string vs std::string Christopher <cpisz@austin.rr.com> - 2011-09-16 15:32 -0700
  Re: c-style string vs std::string Juha Nieminen <nospam@thanks.invalid> - 2011-09-17 06:27 +0000
    Re: c-style string vs std::string Paavo Helde <myfirstname@osa.pri.ee> - 2011-09-17 02:31 -0500
      Re: c-style string vs std::string BGB <cr88192@hotmail.com> - 2011-09-17 09:03 -0700
    Re: c-style string vs std::string Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-17 14:02 +0000
      Re: c-style string vs std::string BGB <cr88192@hotmail.com> - 2011-09-17 08:13 -0700
        Re: c-style string vs std::string Juha Nieminen <nospam@thanks.invalid> - 2011-09-18 15:17 +0000
          Re: c-style string vs std::string BGB <cr88192@hotmail.com> - 2011-09-19 17:44 -0700
  Re: c-style string vs std::string Krice <paulkp@mbnet.fi> - 2011-09-17 00:56 -0700
  Re: c-style string vs std::string Goran <goran.pusic@gmail.com> - 2011-09-17 04:07 -0700
  Re: c-style string vs std::string Noah Roberts <roberts.noah@gmail.com> - 2011-09-17 09:43 -0700
    Re: c-style string vs std::string Ebenezer <woodbrian77@gmail.com> - 2011-09-17 18:53 -0700
    Re: c-style string vs std::string Ebenezer <woodbrian77@gmail.com> - 2011-09-17 18:29 -0700
      Re: c-style string vs std::string Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-18 14:45 +0000
        Re: c-style string vs std::string "Balog Pal" <pasa@lib.hu> - 2011-09-18 18:22 +0200
        Re: c-style string vs std::string Ebenezer <woodbrian77@gmail.com> - 2011-09-18 10:09 -0700
      Re: c-style string vs std::string Oliver Jackson <chexmofo@hotmail.com> - 2011-09-19 00:04 -0700
    Re: c-style string vs std::string James <2johnsons@oh.rr.com> - 2011-09-19 04:20 -0700
  Re: c-style string vs std::string "Balog Pal" <pasa@lib.hu> - 2011-09-17 22:46 +0200
  Re: c-style string vs std::string Gerald Breuer <Gerald.Breuer@Use-Author-Supplied-Address.invalid> - 2011-09-18 05:17 +0200

csiph-web