Classes in D with betterC

Luís Ferreira contact at lsferreira.net
Fri Nov 26 16:01:40 UTC 2021


On Fri, 2021-11-26 at 05:53 +0000, workman via Digitalmars-d-announce
wrote:
> If you can only create C++ class object but can not destroy them, 
> and can not support dynamic cast,  then C++ class object is not 
> working.
> 
> Maybe the title could be "You can use C++ in betterC but they are 
> not working", or add into prefaced section.
> 
> There is no roadmap about when it could be work, or plan to fixed 
> should also be mentioned.

You can do both things, according to the current language
specification. The destructors may have bugs, but you should be able to
do destruction in a correct implementation.

The dynamic cast is perfectly doable too, you just need to implement
your own typeinfo, and it is not that hard and unusual. A clear example
of that is LLVM. They use their own implementation of TypeInfo, see
[here](https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html).

So, arguing that classes doesn't work just because RTTI is not an
intrinsic is not fair.

The whole point of betterC is to prohib the usage or the runtime hooks
or depend on any runtime related symbol and, in C++, std::type_info and
typeid() is an interface provided by the C++ runtime, similar to D
runtime.

-- 
Sincerely,
Luís Ferreira @ lsferreira.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20211126/8dc54ea3/attachment.sig>


More information about the Digitalmars-d-announce mailing list