What should happen here?

Steven Schveighoffer schveiguy at gmail.com
Mon Sep 20 19:20:10 UTC 2021


On 9/20/21 3:00 PM, IGotD- wrote:
> On Monday, 20 September 2021 at 18:49:12 UTC, Steven Schveighoffer wrote:
>>
>> Should it be this way?
> 
> I think regardless, two worlds shouldn't mix. If you have a C function 
> that also stores the allocated data then that data should also be 
> allocated in "C world". Typically you have an additional C function that 
> creates the data/object that you then pass to the C functions. I find it 
> more a design pattern/API problem.
> 
> I'm sure the there are exceptions to what I described where it cannot be 
> used.
> 
> Also, leaving the variable on stack option should be removed in the 
> documentation because how can we know what the compiler decides to do 
> with it.
> 
> 

Then why are pointers to structs, arrays, structs containing class 
references not treated the same?

I'm not sure why class references are singled out, but they are for some 
reason.

-Steve


More information about the Digitalmars-d mailing list