D as A Better C?

Manu turkeyman at gmail.com
Tue Feb 11 19:24:20 PST 2014


On 12 February 2014 12:55, Adam Wilson <flyboynw at gmail.com> wrote:

> On Tue, 11 Feb 2014 18:50:57 -0800, Daniel Murphy <
> yebbliesnospam at gmail.com> wrote:
>
>  "Adam Wilson"  wrote in message news:op.xa5d17y1707hn8@
>> invictus.hra.local...
>>
>>  Awesome, I didn't know that. Does that mean we could add a switch for
>>> default linkage? That's good to know for reasons related to a couple of my
>>> D projects.
>>>
>>
>> It could be done, although I'm not sure it's a good idea.
>>
>
> Why?
>
> Well, I was asking for the D-Core folks, if they could default the linkage
> to C++ then they could use classes without Object. And setting the default
> linkage might be useful for bindings.


It'll create linking problems if different modules refer to eachother, but
happen to be compiled with different flags.
It would be better to use 'extern(C):' at the top of your module, then
modules importing your module know what to expect.

extern(C++) classes are still GC allocated, so it's still not so simple.
You'd need to start using emplace with manual allocation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140212/efc291a2/attachment.html>


More information about the Digitalmars-d mailing list