[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Query on kdelibs/kdecore/io/kgrantpty.c
From:       Thiago Macieira <thiago () kde ! org>
Date:       2007-07-30 13:38:31
Message-ID: 200707301038.31446.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Gabriel Anderson wrote:
>It seems to me like it would be much better to leave a comment at the
>end of the program stating which allocated variables are going to get
>freed when the heap is deallocated.

That's stating the obvious. ALL variables are deallocated when the program 
exits. ALL resources that are local to a process are freed when the 
process ceases to exist.

It's like:
void function()
{
    void *ptr = alloca(128);

    // Don't need to free ptr because it was allocated on the stack
}

or even:
void function()
{
    int i;

    // when this function exits, all variables allocated on the stack
    // will cease to exist
}

Yes, there are resources that might endure (shared memory blocks, files on 
disk, etc.), but those are the exception, not the rule.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic