This is the mail archive of the
mailing list for the Cygwin project.
Re: new vs malloc, was BUG - Cygwin to GNU CC compatibility
- From: "Samuel" <samuel at socal dot rr dot com>
- To: <cygwin at cygwin dot com>
- Date: Wed, 7 Aug 2002 06:19:51 -0700
- Subject: Re: new vs malloc, was BUG - Cygwin to GNU CC compatibility
- References: <email@example.com>
He did not say "multiple invocations of "delete""; he just said "delete",
and saying that no "user code should ever use "delete";" is as valid as
saying that you should never exit a program, that when a program is executed
it must remain executing until the entire system is shut down. It is very
wrong to say that "delete" is not for use by user code.
It sure surprises me that I was the only one that said something about the
innacuracy; if such a thing were to be said in the comp.lang.c++ newsgroup
then the remark would get more ridicule than I see people getting in this
list about anything. Again, if you simply leave off the "multiple" (and Ross
did not say "multiple") from what you said, your statement is highly
inaccurate. Am I the only one in this list that knows this? If so then it is
good that I am correcting this error. This is not a "C++ API / data
structure philosophy debate"; it is not a matter of philosophy; it is a
matter of fact. There have been more than one message recently asking C++
questions that were not relevant to CygWin. I have not seen any messages
saying that they were off-topic. So I do not appreciate being told that I
should not post a small correction to a huge inaccuracy. I know that for
sure the C++ experts in the comp.lang.c++ newsgroup often emphasize that for
every "new" there must be one (and only one) "delete" and for every "new "
there must be one (and only one) "delete ", but that is such a basic thing
that I do not need experts to tell me that.
All C++ questions should be referred to a more appropriate list, newsgroup
or forum, since the advice they get in the CygWin list is dangerous.
----- Original Message -----
From: "Randall R Schulz" <firstname.lastname@example.org>
Sent: Tuesday, August 06, 2002 7:17 PM
Subject: RE: new vs malloc, was BUG - Cygwin to GNU CC compatibility
> Ross, Samuel,
> We can agree that regardless of the specific manifestation of multiple
> invocations of "delete" on any given pointer returned by "new," doing so
> erroneous. And that is a universal fact of C++ programming.
> Perhaps we should avoid a generic C++ API / data structure philosophy
> debate here in the Cygwin list, OK?
> Randall Schulz
> Mountain View, CA USA
> At 18:28 2002-08-06, Ross Smith wrote:
> > > From: Samuel [mailto:email@example.com]
> > >
> > > From: "Ross Smith" <firstname.lastname@example.org>
> > > >
> > > > No user code should ever use "delete"; it should only appear in the
> > > > implementation of a container or smart pointer.
> > >
> > > What? I must misunderstand what is meant, since user code
> > > must always use
> > > "delete" for each "new", unless the documentation of a
> > > function clearly
> > > states that it is the function's responsibility to "delete".
> >This is what smart pointers (std::auto_ptr, boost::shared_ptr, etc) are
> >for. Anything allocated by new should always be held by a smart pointer
> >that will handle deletion automatically, never a raw pointer.
> >Ross Smith
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html