Static array initialisation

russhy russhy at gmail.com
Wed Mar 31 23:21:59 UTC 2021


On Wednesday, 31 March 2021 at 17:54:38 UTC, DLearner wrote:
> On Wednesday, 31 March 2021 at 17:46:25 UTC, Imperatorn wrote:
>> On Wednesday, 31 March 2021 at 17:27:44 UTC, DLearner wrote:
>>> Hi
>>>
>>> I did:
>>>    immutable uint  MemSize=100;  // Memory size in bytes.
>>>
>>> // Memory Pool
>>>    ubyte[MemSize]  MemPool = 8;
>>>
>>> And had a look in memory.
>>> I think the compiler set up 101 '8's, not 100 in memory.
>>>
>>> Which I did not expect.
>>>
>>> Best regards
>>
>> When I look there are 100. What makes you think there are 101?
>
> I printed bytes from &MemPool[0] to just beyond &MemPool[99}.

Can you show the print function?

Maybe the problem lies there?


More information about the Digitalmars-d-learn mailing list