[cfe-dev] operator delete[] does not call derived class destructor
Florian Weimer
fw at deneb.enyo.de
Mon May 21 10:47:06 PDT 2012
* M. E. O'Neill:
> In fact (as I understand it), early in the design of C++, new didn't
> stash the array size and you had remember it yourself and then pass
> it into delete (inside the square brackets). Although Stroustrup
> changed it pretty quickly to the design we know today because people
> hated that hassle, I think the original design would have been more
> true to the C++ philosophy.
Interesting. For current C++, I would agree. But in the pre-template
age without std::vector, that would have been a bit harsh.
> Myself, I'd love it it C++ had better run-time metadata about types,
> even if it were only optional and only enabled with
> -fmore-rtti-please.
Or they could be emitted as soon as you instantiate std::type_info<T>
for some type T.
> As things stand right now, the only way to introspect in a
> meaningful way is to either (a) use facilities intended for the
> debugger, or (b) adopt a coding convention that hand-supplies the
> necessary metadata, duplicating information clang already knows. I
> don't like (b) on principle.
There's also (c), use a code generator (possibly as a compiler
plug-in).
More information about the cfe-dev
mailing list