typedef behavior
Simen Kjærås
simen.kjaras at gmail.com
Mon Feb 12 09:37:56 UTC 2018
On Monday, 12 February 2018 at 09:10:52 UTC, Alex wrote:
>> 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.
>
> 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?
Not really, since D doesn't have a concept of an address
associated with a type, only with instances of it. So when you
use a static array, the address is hard-coded.
--
Simen
More information about the Digitalmars-d-learn
mailing list