Super easy struct construction question that I'm embarrassed to ask.

Jim Balter Jim at Balter.name
Mon Jan 13 04:05:25 UTC 2025


On Thursday, 9 January 2025 at 22:08:31 UTC, Dennis wrote:
> On Thursday, 9 January 2025 at 22:01:59 UTC, WhatMeWorry wrote:
>>     this(Location locaction, uint f) {
>>         this.location = location;
>>         this.f = f;
>>     }
>
>
> You misspelled the parameter name 'locaction', so your 
> assignment in the constructor is a no-op:
>
> ```
> this.location = this.location
> ```

Which is why languages like Zig disallow such code ... unused 
variables must be identified as such.


More information about the Digitalmars-d-learn mailing list