What should happen here?

IGotD- nise at nise.com
Mon Sep 20 19:00:38 UTC 2021


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.




More information about the Digitalmars-d mailing list