What to do after Python?

Rainer Deyke root at rainerdeyke.com
Sun Feb 18 20:41:36 EST 2001


"Kenneth Loafman" <ken at lt.com> wrote in message
news:mailman.982538961.27262.python-list at python.org...
> Please also teach the C Standard Library along with C++.  I've seen some
> very poor examples of "reinventing the wheel" happen because the student
> did not even know the basics of the C Standard Library and its
> interaction with the basic elements of C/C++.  Consider one case I found
> where the goal was to remove the last character of a line.  Instead of
> using something like:
>
>    if (strlen(s)) s[strlen(s)-1] = 0

Argh!

The following is the correct ways of doing this in C++:

s = std::string(s.begin(), s.end() - 1);

Not using 'std::string' in C++ is analogous to not using the built-in string
type in Python.


--
Rainer Deyke (root at rainerdeyke.com)
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor





More information about the Python-list mailing list