D has the same memory model as C++
Tejas
notrealemail at gmail.com
Wed Aug 11 05:33:06 UTC 2021
On Tuesday, 10 August 2021 at 21:19:39 UTC, Bastiaan Veelo wrote:
> On Tuesday, 10 August 2021 at 16:00:37 UTC, Tejas wrote:
>> Basically, what are the subtle gotcha's in the differences
>> between C++ and D code that looks similar
>
> The only gotcha that comes to my mind is that `private` means
> private to the module in D, not private to the aggregate.
>
> — Bastiaan.
A few others that I know:
When importing one module(say ```m2```) into another (say
```m1```), the symbols of ```m1``` aren't automatically visible
in ```m2```. You must import ```m1``` in ```m2``` for that.
You can't just initialize variables willy-nilly in a module, you
must do them inside ```static this()```
Method function pointers don't exist in D, equivalent
functionality is achieved by using a delegate that captures the
context of a class instantiated object.
To use a function pointer explicitly, you can't just write
```(func)(arguments)```, it is ```(&func)(arguments)```(thank you
evilrat)
```sizeof/alignof``` differs in D and C++(thank you evilrat)
More information about the Digitalmars-d-learn
mailing list