Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Dec 2000 14:38:47 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        "Jacques A. Vidrine" <n@nectar.com>, Warner Losh <imp@village.org>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Why not another style thread? (was Re: cvs commit: src/lib/libc/gen getgrent.c)
Message-ID:  <p04330104b66417847d3c@[128.113.24.47]>
In-Reply-To: <20001218131112.B65143@hamlet.nectar.com>
References:  <20001217151509.A63051@hamlet.nectar.com> <20001217151735.D54486@holly.calldei.com> <20001217153129.B63080@hamlet.nectar.com> <20001217153656.F54486@holly.calldei.com> <20001217155648.C63080@hamlet.nectar.com> <20001217160442.H54486@holly.calldei.com> <20001217170316.A63227@hamlet.nectar.com> <200012180501.WAA87838@harmony.village.org> <20001218123108.A65143@hamlet.nectar.com> <200012181840.LAA92561@harmony.village.org> <20001218131112.B65143@hamlet.nectar.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 1:11 PM -0600 12/18/00, Jacques A. Vidrine wrote:
>Ever notice that you tend to send more email when you should be
>studying for a final?

I did notice that I write very few letters now, compared to when
I was in college and still facing exams/finals...

>   /* Case 1 */                               /* Case 2 */
>   if (data)                 vs.              free(data)
>           free(data);
>
>I don't see that Case 1 obfuscates anything.  In some cases
>I find it clearer:  Case 1 implies that maybe no memory was
>allocated.  Case 2 seems to imply that memory was indeed
>allocated.

For what it's worth, my preference is to also zero out
'data' after freeing it.  I tend to do the 'if (data)'
part, particularly if I'm also doing that test for other
reasons.

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p04330104b66417847d3c>