struct Location size

Walter Bright newshound2 at digitalmars.com
Wed May 10 03:16:19 UTC 2023


On 5/9/2023 1:35 AM, Basile B. wrote:
> Yes, call me a madlad but in styx the filename information is in the DMD 
> equivalent of `Scope` (and the Loc is 2*32 bits, {line,col}). If you do the same 
> in DMD you can reduce the size to 32 bits, i.e 2*16 bits, {line,col}.
> 
> I'm not sure this would work for DMD but for styx the rationale was
> 
> 1. in DMD the size of Loc is a known problem, that's why it's usually 
> recommended to pass its instances by ref, let's not have the same problem.
> 2. there's much less Scopes than Loc.


Indeed, it would eliminate the pass-by-ref of Loc.


More information about the Digitalmars-d mailing list