www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/02/18:00:04

Path: news.mv.net!news.shore.net!newsfeed.mathworks.com!portc01.blue.aol.com!europa.netcrusader.net!194.176.220.130!newsfeed.icl.net!diablo.theplanet.net!news.theplanet.net!newspost.theplanet.net!not-for-mail
From: Jason Green <mail AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: *** OFF-TOPIC *** Re: ok, I have more info on problem at hand
Date: Sat, 02 Sep 2000 22:54:11 +0100
Organization: Customer of Energis Squared
Lines: 36
Message-ID: <qdr2rssq4e4v10sl1ud4sj0ahdcnpk19u6@4ax.com>
References: <Mtg9LD_00Uw9QI9Fw3 AT andrew DOT cmu DOT edu> <hsn1rs04jjeiksk1saev2cfjv5fpafqp1f AT 4ax DOT com> <8oqt7m$6of$1 AT plato DOT wadham DOT ox DOT ac DOT uk> <smd2rskgoliuo3lpknet1pgf39ipfqdhtg AT 4ax DOT com> <Pine DOT LNX DOT 4 DOT 21 DOT 0009021839050 DOT 7932-100000 AT plato DOT wadham DOT ox DOT ac DOT uk>
NNTP-Posting-Host: modem-120.delaware.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg4.svr.pol.co.uk 967931689 5373 62.137.59.120 (2 Sep 2000 21:54:49 GMT)
NNTP-Posting-Date: 2 Sep 2000 21:54:49 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
Xref: news.mv.net comp.os.msdos.djgpp:103112

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019