typedef behavior

Alex sascha.orlov at gmail.com
Mon Feb 12 09:10:52 UTC 2018


On Monday, 12 February 2018 at 08:51:14 UTC, Simen Kjærås wrote:
> I agree that'd be nice. Sadly, it's not a reasonable 
> expectation. :(

:)

> A more extreme example: You have a compiled library, and some 
> .di (header) files. In one of those files is this code:
>
> struct S {
>     static int[] arr;
>     void foo();
> }
>
> Now how should Typedef go about making foo() do the right 
> thing? Even with compiler support, this is impossible - the 
> source of S.foo is simply not available, and it doesn't take 
> the address of the static data as a parameter anywhere.
>
> --
>   Simen

But isn't foo scoped somehow?
I mean, if foo is part of a type, then either you have to write 
s.foo, or S.foo. And if the address of a static belongs to a 
type, shouldn't this resolve the ambiguities?


More information about the Digitalmars-d-learn mailing list