[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: lifetime of strings
- From: Christian Vogler <cvogler@...>
- Date: Mon, 4 Sep 2000 03:09:01 -0400
Hello,
please consider this code:
WORKDIR = "foo"
FILETOTRACK = "bar"
dosomething(WORKDIR .. "/" .. FILETOTRACK)
dosomething() is a C function that stores a char * pointer to the string,
which needs to be valid even after this function returns.
What is the lifetime of the string passed to dosomething()? Will it
eventually be garbage-collected sometime after dosomething() has
returned? So, would dosomething() have to make a copy of the string?
- Christian