How to pass a class by (const) reference to C++

Jan Jan at Krassnigg.de
Wed Dec 15 22:01:19 UTC 2021


On Wednesday, 15 December 2021 at 21:30:47 UTC, Tim wrote:
> It seems to work if var is additionally static:

Ha, it works indeed!

```cpp
extern export __gshared static int var;
```

That's a declaration worthy of C++ ! Fewer keywords would be too 
usable :D

Joking aside, I understood the docs such that `__gshared` 
actually *is* `static` in D, no? Also why the `export` when it's 
an extern variable?




More information about the Digitalmars-d-learn mailing list