Mail Archives: djgpp/2000/09/02/18:00:04
J-P <jstacey AT plato DOT wadham DOT ox DOT ac DOT uk> wrote:
> >> ... unless you ever want to resize, in which case use malloc() and
> >> realloc() and explicitly cast the pointers.
> >
> >The standard containers will let you resize.
>
> Do you mean the standard classes? Because I'm sure even Bjarne Stroustrup
> (sp?) has said otherwise in some tome, but I could be wrong.
"Using resize() on a vector is very similar to using the C standard
library function realloc() on a C array allocated on the free store."
- Bjarne Stroustrup, C++PL3.
> If so, that isn't much use if you're not using the standard classes.
This is precisely the argument *for* using the STL. Increased
flexibility/efficiency and no performance hit. That's the theory
anyway - I couldn't possibly comment. ;-)
> I merely wanted to mention it as an /option/, not as a flame. Which is why
> I don't particularly want to redirect this to comp.lang.c++, because [a]
> they probably only deal with the ANSI recommendation, whatever that is
> this week (that sort of , and [b] they've probably had this argument
> several times before, initiated with the intention of flaming.
>
> If malloc() has no place in C++, then it's odd that you're still able to
> use it.
I didn't say that malloc() has no place in C++. (but I can see how you
might read that).
The C++ standard, as far as possible, is backward compatible with
conforming C code. However, there were a few things the C++ standard
committee felt were more important then backward compatibilty, and
implicit conversion of void pointers was one of them.
- Raw text -