On Friday, 18 October 2024 at 07:43:47 UTC, Richard (Rikki)
Andrew Cattermole wrote:
Sorry for not replying sooner, COVID has not been a fun virus
for my mind to have.
When a variable is declared with a struct that needs cleanup,
it effectively rewrites the following statements into a try
f
On 13/10/2024 6:12 PM, Salih Dincer wrote:
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..
On Sunday, 13 October 2024 at 05:12:32 UTC, Salih Dincer wrote:
Can we say that structs are in the stack (LIFO) as long as we
do not use the new operator?
Just to note that `new` does not give you a struct, it gives a
struct pointer. Structs use the stack when declared inside a
stack-allocate
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
On 13/10/2024 3:12 AM, Salih Dincer wrote:
You are not wrong, when it is a struct, it is being heap allocated.
Looks like the optimization for classes, hasn't been applied to structs.
https://issues.dlang.org/show_bug.cgi?id=24806
So if |scope| is a facility for classes, it should
On Saturday, 12 October 2024 at 13:08:03 UTC, Nick Treleaven
wrote:
If you want stack allocation of structs, why use `new`?
Actually, I almost never use the new operator except with(). I
was surprised because it seemed inconsistent here and wanted to
share my experiment.
On Saturday, 12 Oc
You are not wrong, when it is a struct, it is being heap allocated.
Looks like the optimization for classes, hasn't been applied to structs.
https://issues.dlang.org/show_bug.cgi?id=24806
On Saturday, 12 October 2024 at 12:10:17 UTC, Salih Dincer wrote:
On Saturday, 12 October 2024 at 12:02:04 UTC, Salih Dincer
wrote:
... even if I call the structure with the new operator. But if
I stop using classes, scope doesn't work properly!
Declaring a `scope SomeClass` initialized with `
On Saturday, 12 October 2024 at 12:02:04 UTC, Salih Dincer wrote:
... even if I call the structure with the new operator. But if
I stop using classes, scope doesn't work properly!
Edit: It seems like scope is ineffective in structures. In fact,
if there is the new operator, it is as if scope d
I have a small program like below. Everything works as it should
in classes; even if I call the structure with the new operator.
But if I stop using classes, scope doesn't work properly!
```d
class/* STEP2
struct//*/
Foo {
this(int i) {
i.writefln!"Object %s is created...";
}
~this()
10 matches
Mail list logo