Address of a class object

areYouSureAboutThat areYouSureAboutThat at gmail.com
Thu Jan 5 06:32:47 UTC 2023


On Thursday, 5 January 2023 at 04:04:39 UTC, Paul wrote:
>
> ..
> Do I have this much right?
> ...

First, i would say, add @safe to your main.

@safe void main() ...

Then you will see you are treading on dangerous waters ;-)

Second, to be sure your getting the correct results, it would be 
nice if there was a 'category of type' in std.traits for:

isAllocatedOnStack
isAllocatedOnHeap

As it is, your just guessing (although the addresses printed will 
clear this up for you anyway I guess).

Also, I cannot read hex, so if it were me, I'd be casting the hex 
into an size_t:

cast(size_t)&MyInt



More information about the Digitalmars-d-learn mailing list