[PATCH] Re: What not to be doing - syscall()

Oswald Buddenhagen ossi at kde.org
Thu Dec 25 12:16:12 GMT 2003


On Thu, Dec 25, 2003 at 10:53:28AM +0100, Frans Englich wrote:
> True.. :|
> 
> >
> > {
> >   KUser ku;
> >   pty->login( ku.loginName().latin1(), getenv("DISPLAY"));
> > }
> 
> Let me see if I got this straight.. Does that code snippet work as good as 
> pty->login( KUser().loginName().latin1(), getenv("DISPLAY"));?
>
yup. the compiler will create exactly the same code, i think. i was
somewhat sleepy yesterday. :}

> Regarding Thiago's comment on the code snippet:
> +  const char *user = KUser().loginName().latin1();
> pty->login( user ... ;
> Isn't the "temporary" KUser object created on stack and should live until end 
> of scope?
> 
the end of the scope for the KUser object is the end of the statement.
ergo thiago is right.

greetings

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.




More information about the kde-core-devel mailing list