toStringz lifetime

Ali Çehreli acehreli at yahoo.com
Mon Nov 9 03:53:53 UTC 2020


On 11/8/20 6:58 PM, rikki cattermole wrote:

 > On 09/11/2020 2:58 PM, Ali Çehreli wrote:
 >> Does the D GC know the complete function call stack of the C program
 >> all the way up from 'main'? Is there the concept of "bottom of the
 >> stack"

 > 
https://github.com/dlang/druntime/blob/master/src/core/thread/osthread.d#L1455 


 > I'm tired, so here is the code related to your questions.

Hey, I'm tired too! :p

Thank you. By the presence of getStackTop() and getStackBottom() above, 
I'm convinced that the entire stack is available. So, pointer returned 
by toStringz will be kept alive by the C caller during their immediate 
use. (They obviously cannot store for later use.)

Ali




More information about the Digitalmars-d-learn mailing list