Topic: delete in C (Was: delete of const objects o.k.?)


Author: "Douglas A. Gwyn" <DAGwyn@null.net>
Date: 1999/09/03
Raw View
David R Tribble wrote:
> Valentin Bonnard wrote:
> > (I think that's a step in right direction. Now, add classes.)
> In the words of one of the ISO C committee members, there would be
> several dead bodies over which this would be done.

I don't know who said that, but it is misleading if not outright
wrong.  WG14 did spend *considerable* committee time, in the early
phases of work toward C9x, to evaluate proposals for some support
for classes in C9x.  The main question was how much of C++ would be
needed to make "C with classes" really useful to the C programmer.
Most of us drew the line short of virtual functions.  (As it turned
out, not even C++ [as of the start of the C++ standards process]
was enough to really satisfy OO programmers, witness the addition of
exceptions, templates, and namespaces.)  Eventually a slight
consensus developed for the view that C++ was going to be widely
enough available that programmers wanting the OO paradigm would be
better served by just using C++.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/09/01
Raw View
David R Tribble wrote:

> Valentin Bonnard wrote:

> > C was extended to support delete ?

> Uh, no.

Thanks for the info.

> Perhaps the only useful thing that could be added to C without
> too much fuss would be namespaces,

??? (you must be jocking)

--

Valentin Bonnard
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/08/28
Raw View
Siemel B. Naran wrote:

> You don't.  You allocate a real object, then cast the T* to a void*.
> As C supports "delete (void*)v", C++ supports it too.

C was extended to support delete ?

(I think that's a step in right direction. Now,
add classes.)

--

Valentin Bonnard
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: David R Tribble <david@tribble.com>
Date: 1999/08/30
Raw View
Valentin Bonnard wrote:
>
> Siemel B. Naran wrote:
>
>> You don't.  You allocate a real object, then cast the T* to a void*.
>> As C supports "delete (void*)v", C++ supports it too.
>
> C was extended to support delete ?

Uh, no.  C supports 'free((void *)v);' as the only standard method
of deallocating dynamic (heap) memory.  And the cast to 'void*' is
completely optional.

> (I think that's a step in right direction. Now, add classes.)

In the words of one of the ISO C committee members, there would be
several dead bodies over which this would be done.

The requirements of supporting member functions (i.e., name mangling)
is enough alone to complicate the linkage model of C that too many
people would say no, leave it alone, keep it simple.  Throw in far
more complicated things like dynamic static initialization,
destructors, templates, exceptions, and so on, and then... well,
what's the point?

Perhaps the only useful thing that could be added to C without
too much fuss would be namespaces, and even that complicates the
simple linkage model used by C.

If you want C++ you know where to get it.  If you don't want all
of that, then you should be happy using C.  (I use both, and like
them both.)

[Cross-posted to news:comp.std.c  -drt]

-- David R. Tribble, david@tribble.com --


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: 1999/08/29
Raw View
Valentin Bonnard wrote:
>
> Siemel B. Naran wrote:
>
> > You don't.  You allocate a real object, then cast the T* to a void*.
> > As C supports "delete (void*)v", C++ supports it too.
>
> C was extended to support delete ?
>
> (I think that's a step in right direction. Now,
> add classes.)

At that point, why call it C?


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/08/30
Raw View
James Kuyper Jr. wrote:

> Valentin Bonnard wrote:

> > C was extended to support delete ?
> >
> > (I think that's a step in right direction. Now,
> > add classes.)
>
> At that point, why call it C?

'cause some people don't like the ``++'' part.

--

Valentin Bonnard
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]