[PATCH] Re: What not to be doing - syscall()
Frans Englich
frans.englich at telia.com
Thu Dec 25 13:00:51 GMT 2003
On Thursday 25 December 2003 13:16, Oswald Buddenhagen wrote:
> 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. :}
One day /I/ will code and I will be sleepy. It is called the doom's day.
:)
>
> > 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.
Yeah, I don't doubt it, I was just pussled since I found it resonable it would
live a little longer since (me judging from the syntax) it is created on the
stack.. The resulting output must do an explicit "delete" on that object..
drifting..
Cheers,
Frans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getlogin.kdebase.diff
Type: text/x-diff
Size: 1006 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20031225/575f760e/attachment.diff>
More information about the kde-core-devel
mailing list