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


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

Re: C Containers Library vs STL

From jacob navia <jacob@spamsink.net>
Newsgroups comp.lang.c++
Subject Re: C Containers Library vs STL
Date 2011-08-04 01:30 +0200
Organization lccwin
Message-ID <j1clm8$ibc$1@speranza.aioe.org> (permalink)
References <j1cboc$qj2$1@speranza.aioe.org> <99trvaF9m3U1@mid.individual.net> <tqij37ppjbron0fcdsdvua5e7pigfra7k1@4ax.com> <jejj37prnheru64sshk40btqtan2ll8n5r@4ax.com>

Show all headers | View raw


Le 04/08/11 00:38, Robert Wessel a écrit :
> On Wed, 03 Aug 2011 17:36:54 -0500, Robert Wessel
> <robertwessel2@yahoo.com>  wrote:
>

>>
>> I'd point out that unlike Jacob's original, you're not displaying a
>> line number, although that's trivial.  You'd probably change to cout
>> to something like
>>
>> std::cout<<  "["<<  setw(3)<<  linenumber<<  "] "<<  line<<  std:endl;
>>
>> And add the appropriate code to maintain linenumber.
>
>
> errr...   std::setw(3)

Thanks to you and to Ian.

More important than the line number, is the behavior of the STL
container in case of errors, for instance when there is no more
memory.  Does it throw an exception? In that case it would be
fully equivalent of the C code that tests for the return code
being less than zero.

In my Macintosh I compile using gcc the code to
-rw-r--r--  1 jacobnavia  staff  6548  3 aoû 23:23 unique.o // CPP
-rw-r--r--  1 jacobnavia  staff  1348  3 aoû 23:23 unique1.o // C

both are compiled using -Os (size optimization) using the same commpiler
~/Documents/stl $ gcc -v
Using built-in specs.
Target: i686-apple-darwin10
gcc version 4.2.1 (Apple Inc. build 5664)


I think that the codes are really equivalent, and I am pleased that
the CCL doesn't come all that bad. What performance is concerned
I doubt that there would be any differences since the programs are
bound by I/O anyway


Thanks again for your answers.

jacob

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


Thread

C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-03 22:40 +0200
  Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 09:13 +1200
    Re: C Containers Library vs STL Robert Wessel <robertwessel2@yahoo.com> - 2011-08-03 17:36 -0500
      Re: C Containers Library vs STL Robert Wessel <robertwessel2@yahoo.com> - 2011-08-03 17:38 -0500
        Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 01:30 +0200
          Re: C Containers Library vs STL Robert Wessel <robertwessel2@yahoo.com> - 2011-08-03 18:40 -0500
            Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 13:42 +0200
          Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 12:34 +1200
            Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 13:38 +1200
              Re: C Containers Library vs STL Juha Nieminen <nospam@thanks.invalid> - 2011-08-04 07:02 +0000
                Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 19:40 +1200
                Re: C Containers Library vs STL Juha Nieminen <nospam@thanks.invalid> - 2011-08-04 14:16 +0000
                Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 16:25 +0200
                Re: C Containers Library vs STL Nobody <nobody@nowhere.com> - 2011-08-04 21:40 +0100
            Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 09:42 +0200
              Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 19:59 +1200
              Re: C Containers Library vs STL Marc <marc.glisse@gmail.com> - 2011-08-04 12:47 +0000
                Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 15:17 +0200

csiph-web