Random thought: Alternative stuct
rikki cattermole
rikki at cattermole.co.nz
Thu Sep 6 05:40:59 UTC 2018
On 04/09/2018 3:38 PM, Nick Sabalausky (Abscissa) wrote:
> We have classes and structs:
>
> Classes:
> - Default Storage: GC Heap
> - Indirection Overhead: Yes
> - Semantics: Reference
> - Passed By: Copying the Data's Address
>
> Structs:
> - Default Storage: Stack
> - Indirection Overhead: No
> - Semantics: Value
> - Passed By: Copying the Data (except where the compiler can determine
> it can safely and more efficiently pass by reference...at least, IIUC)
Signatures:
- Default Storage: Heap (with help of scope so won't be GC'd)
- Indirection Overhead: Yes, one layer, no other way to do it if the
backend can't optimize it out
- Semantics: Reference
- Passed By: Copying a pointer static array around (ref+scope can make
this near free)
- Implementation support: Classes and structs
More information about the Digitalmars-d
mailing list