What to do after Python?
Kenneth Loafman
ken at lt.com
Mon Feb 19 08:31:32 EST 2001
Rainer Deyke wrote:
>
> "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.
They were using CString under M$VC. I don't think std::string existst
on the M$ compilers. Would make it too easy to port to the heathen UNIX
boxen <grin>.
...Ken
More information about the Python-list
mailing list