On Saturday, 12 October 2024 at 13:11:52 UTC, Richard (Rikki)
Andrew Cattermole wrote:
You are not wrong, when it is a struct, it is being heap
allocated.
Sorry for prolonging the topic. I am very curious about your
answers along with your patience...
Can we say that structs are in the stack (LIFO) as long as we do
not use the new operator? Also, should using scope in structures
cause a change? I never seen it does! However, there is no
incompatibility here: Whether it is a class or a struct, when you
use the new operator, the first run constructor becomes the first
run destructor with FIFO logic.
You can reverse this situation with scope (but only in classes).
By reverse I don't mean LIFO! In fact, the correct expression is
that when you are done with the object, it is removed.
Thanks, SDB@79
- Scope & Stru... Salih Dincer via Digitalmars-d-learn
- Re: Scope &... Salih Dincer via Digitalmars-d-learn
- Re: Sco... Nick Treleaven via Digitalmars-d-learn
- Re:... Salih Dincer via Digitalmars-d-learn
- ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- Re: Scope &... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- Re: Sco... Salih Dincer via Digitalmars-d-learn
- Re:... Nick Treleaven via Digitalmars-d-learn
- Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
- ... Salih Dincer via Digitalmars-d-learn