From owner-freebsd-hackers Mon Dec 18 11:39:13 2000 From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 18 11:39:11 2000 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.100.7]) by hub.freebsd.org (Postfix) with ESMTP id C06CA37B400 for ; Mon, 18 Dec 2000 11:39:10 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.9.3/8.9.3) with ESMTP id OAA717150; Mon, 18 Dec 2000 14:38:49 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: 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> Date: Mon, 18 Dec 2000 14:38:47 -0500 To: "Jacques A. Vidrine" , Warner Losh From: Garance A Drosihn Subject: Re: Why not another style thread? (was Re: cvs commit: src/lib/libc/gen getgrent.c) Cc: hackers@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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