[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tolua potential memory leak?
- From: Ben Sunshine-Hill <sneftel@...>
- Date: Thu, 24 Feb 2005 12:17:01 -0800
On Thu, 24 Feb 2005 17:07:52 -0300, Alex Sandro Queiroz e Silva
<ventonegro@ventonegro.org> wrote:
> Brian Weed wrote:
> >
> > const char * getSome()
> > {
> > return "some string";
> > }
>
> The address of the string would be meaningless after the return of
> this function, wouldn't it?
No... string literals aren't on the stack, so the pointer will remain
valid. (Not sure if this is specified by the standard, or just the way
everyone does it.)