From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91065 invoked by alias); 1 Jun 2015 21:47:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 91046 invoked by uid 89); 1 Jun 2015 21:47:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 01 Jun 2015 21:47:03 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 85F252E6CDB; Mon, 1 Jun 2015 21:47:02 +0000 (UTC) Received: from greed.delorie.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t51Ll1ld024532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Jun 2015 17:47:02 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.14.4/8.14.4) with ESMTP id t51Ll0Dr015581; Mon, 1 Jun 2015 17:47:00 -0400 Received: (from dj@localhost) by greed.delorie.com (8.14.4/8.14.4/Submit) id t51Ll08P015579; Mon, 1 Jun 2015 17:47:00 -0400 Date: Mon, 01 Jun 2015 23:14:00 -0000 Message-Id: <201506012147.t51Ll08P015579@greed.delorie.com> From: DJ Delorie To: David Malcolm CC: gcc-patches@gcc.gnu.org, binutils@sourceware.org In-reply-to: <1433192664-50156-9-git-send-email-dmalcolm@redhat.com> (message from David Malcolm on Mon, 1 Jun 2015 17:04:16 -0400) Subject: Re: [PATCH 08/16] libiberty.h: Provide a CLEAR_VAR macro References: <1433192664-50156-1-git-send-email-dmalcolm@redhat.com> <1433192664-50156-9-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00139.txt.bz2 > +/* Fill an lvalue with zero bits. */ > +#define CLEAR_VAR(S) \ > + do { memset (&(S), 0, sizeof (S)); } while (0) Hmmm... I don't see the point in this. The macro is almost as long as a bare memset() would be, and replaces a well-known function with something unknown outside this project. It neither hides a bug in an OS nor provides a common way to handle a difficult task across platforms. You also do NOT want to use memset to zero out a C++ structure that contains more than just "plain old data" - you could easily corrupt the structure's hidden data. Also, pedantically speaking, "all bits zero" is not guaranteed to be the same as float 0.0, double 0.0, or pointer (void *)0.