Topic: Names in C++ (Was: The new C++ draft)
Author: AllanW@my-dejanews.com
Date: 1998/08/04 Raw View
In article <35c58029.4160772@news.demon.co.uk>,
tjsharrock@iee.org (Tim Sharrock) wrote:
> On 02 Aug 98 08:55:32 GMT, Valentin Bonnard <bonnardv@pratique.fr>
> wrote:
>
> [...]
> >The C++ standard defines names like vector::push_back,
> >string::insert, set::clear. What do you expect ?
> >vector::add_one_element_at_the_end_of_the_sequence,
> >set::delete_every_element_in_this_containner ?
>
> push_back disconcerted me at first. I looked for all
> the names I usually used: "add", "append" and so on.
> I would only have expected "push" in a stack abstraction.
Indeed, this is exactly what push_back is meant to imply. Fortunately,
most of the containers can be used in ways analagous to stacks.
If you can't (or don't want to) think about a stack while you extend
a container, use insert instead.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: tjsharrock@iee.org (Tim Sharrock)
Date: 1998/08/05 Raw View
On 04 Aug 98 17:05:49 GMT, James Kuyper <kuyper@wizard.net> wrote:
>Tim Sharrock wrote:
>...
>> than C - those of my colleagues who have much more Fortran
>> experience than C tend to use vector in preference to list,
>> while those with more C than Fortran, particularly from
>> when it was usual to write your own collection handling
>> code every time, tend to use list).
>
>There are a lot of significant differences between list<> and vector<>;
>some of those people have to be making bad decisions.
Sometimes yes, but many data-structures are not time or space critical.
Those that are DO get the attention paid to them, but the sort of case
I had in mind was when you need to store a few dozen objects, none of
them particularly big or complex, and you do not need to access them
very often. In this case choosing list or vector makes no significant
difference.
In other cases the differences can indeed be very significant.
Tim
--
Tim Sharrock (tjsharrock@iee.org)
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: James Kuyper <kuyper@wizard.net>
Date: 1998/08/04 Raw View
Tim Sharrock wrote:
...
> than C - those of my colleagues who have much more Fortran
> experience than C tend to use vector in preference to list,
> while those with more C than Fortran, particularly from
> when it was usual to write your own collection handling
> code every time, tend to use list).
There are a lot of significant differences between list<> and vector<>;
some of those people have to be making bad decisions.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Valentin Bonnard <bonnardv@pratique.fr>
Date: 1998/08/02 Raw View
Mike Ost & Martha Wade wrote:
> I think the new C++ standard is an abomination. The class and method names
> in STL, especially, are incredibly cryptic and terse. BidItr? Come on! This
> is the 90s! Write it out!
The name BidItr doesn't even appear in the standard. BidItr
is an abbreviation for BidirectionnalIterator. You can use
it (or not) if you want, the same way you can write ptr
instead of pointer.
One comment about names: with Unix, you have names like
brk, shmdt, acct. Clear and explicit, isn't it ? ;-)
The C++ standard defines names like vector::push_back,
string::insert, set::clear. What do you expect ?
vector::add_one_element_at_the_end_of_the_sequence,
set::delete_every_element_in_this_containner ?
Names introduced recently in C++ are pronouncable
and resonnably clear. Names under Unix and some
names in std C library are not.
Instead of making angry misinformed posts, learn C++,
read books, and then come back with usefull ideas or
critics. It's too late to change the standard, but
it's always time to post usefull information, develop
programming skills and understand the problems with C++.
If you just want to hate C++, then program in the
language you prefer and go away.
--
Valentin Bonnard mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: tjsharrock@iee.org (Tim Sharrock)
Date: 1998/08/04 Raw View
On 02 Aug 98 08:55:32 GMT, Valentin Bonnard <bonnardv@pratique.fr>
wrote:
[...]
>The C++ standard defines names like vector::push_back,
>string::insert, set::clear. What do you expect ?
>vector::add_one_element_at_the_end_of_the_sequence,
>set::delete_every_element_in_this_containner ?
>
>Names introduced recently in C++ are pronouncable
>and resonnably clear. Names under Unix and some
>names in std C library are not.
push_back disconcerted me at first. I looked for all
the names I usually used: "add", "append" and so on.
I would only have expected "push" in a stack abstraction.
(This may be because of my background in Fortran rather
than C - those of my colleagues who have much more Fortran
experience than C tend to use vector in preference to list,
while those with more C than Fortran, particularly from
when it was usual to write your own collection handling
code every time, tend to use list).
Tim
--
Tim Sharrock (tjsharrock@iee.org)
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]