Re: Compile-time predicate for checking whether an aggregate field is static

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn

On Saturday, 2 March 2024 at 19:09:23 UTC, kinke wrote:

On Saturday, 2 March 2024 at 15:22:03 UTC, Per Nordlöw wrote:
How do I at compile-time check whether an aggregate field is 
static?


https://dlang.org/phobos/std_traits.html#hasStaticMember 
perhaps.


Thanks. Neither my web searches nor ChatGPT plus couldn't figure 
that out.


Re: Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn

On Saturday, 2 March 2024 at 19:28:08 UTC, Per Nordlöw wrote:

On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote:
Not according to run.dlang.io, for all available DMD versions. 
Perhaps your tested `S` was nested in some function/aggregate 
and so had an implicit context pointer.


Ahh. Yes. Indeed. My mistake. Thanks.


Thanks. Neither my websearches nor ChatGPT plus couldn't figure 
that out.


Re: Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn

On Saturday, 2 March 2024 at 19:11:42 UTC, kinke wrote:
Not according to run.dlang.io, for all available DMD versions. 
Perhaps your tested `S` was nested in some function/aggregate 
and so had an implicit context pointer.


Ahh. Yes. Indeed. My mistake. Thanks.


Re: Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread kinke via Digitalmars-d-learn

On Saturday, 2 March 2024 at 15:25:48 UTC, Per Nordlöw wrote:
Why does disabling a struct's postblit increase its sizeof by 
one word?


The following holds:

```d
struct S { @disable this(this); int _; }
struct T { int _; }
static assert(S.sizeof == 16);
static assert(T.sizeof == int.sizeof);
```


Not according to run.dlang.io, for all available DMD versions. 
Perhaps your tested `S` was nested in some function/aggregate and 
so had an implicit context pointer.


Re: Compile-time predicate for checking whether an aggregate field is static

2024-03-02 Thread kinke via Digitalmars-d-learn

On Saturday, 2 March 2024 at 15:22:03 UTC, Per Nordlöw wrote:
How do I at compile-time check whether an aggregate field is 
static?


https://dlang.org/phobos/std_traits.html#hasStaticMember perhaps.


Why does disabling a struct's postblit increase its size in memory?

2024-03-02 Thread Per Nordlöw via Digitalmars-d-learn
Why does disabling a struct's postblit increase its sizeof by one 
word?


The following holds:

```d
struct S { @disable this(this); int _; }
struct T { int _; }
static assert(S.sizeof == 16);
static assert(T.sizeof == int.sizeof);
```

. Why is this needed?


Re: New update fix

2024-03-02 Thread user1234 via Digitalmars-d-learn

On Saturday, 2 March 2024 at 08:41:40 UTC, Salih Dincer wrote:

SLM,

What exactly did this patch with the new update fix?


Nothing, it looks like what happened is that the issue was 
wrongly referenced by a dlang.org PR 
(https://github.com/dlang/dlang.org/pull/3701/commits/4e8db30f0bf3c330c3431e83fe8a75f843b40857).