From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id B4EB11F8C8 for ; Mon, 20 Sep 2021 19:20:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350418AbhITTWR (ORCPT ); Mon, 20 Sep 2021 15:22:17 -0400 Received: from cloud.peff.net ([104.130.231.41]:51068 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347703AbhITTUN (ORCPT ); Mon, 20 Sep 2021 15:20:13 -0400 Received: (qmail 2140 invoked by uid 109); 20 Sep 2021 19:18:45 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Mon, 20 Sep 2021 19:18:45 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 21811 invoked by uid 111); 20 Sep 2021 19:18:40 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Mon, 20 Sep 2021 15:18:40 -0400 Authentication-Results: peff.net; auth=none Date: Mon, 20 Sep 2021 15:18:40 -0400 From: Jeff King To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: phillip.wood@dunelm.org.uk, "brian m. carlson" , Junio C Hamano , Derrick Stolee via GitGitGadget , git@vger.kernel.org, Johannes.Schindelin@gmx.de, jnareb@gmail.com, pclouds@gmail.com, carenas@gmail.com, Derrick Stolee Subject: Re: [PATCH v4 3/6] commit-graph: turn on commit-graph by default Message-ID: References: <651e2d526b2a3f6c63c64cfe1f049eef94d39c07.1565721461.git.gitgitgadget@gmail.com> <8841729f-9310-c393-caa9-4b209909ea5d@gmail.com> <8735pzbbtk.fsf@evledraar.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8735pzbbtk.fsf@evledraar.gmail.com> Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Sep 20, 2021 at 03:30:38PM +0200, Ævar Arnfjörð Bjarmason wrote: > Thus the anti-pattern, yes set defaults for some members to -1, but not > the entire struct. The only value we should memset a whole bag-of-stuff > config struct to is 0, as that's the only sensible default & plays well > with other C semantics. FWIW, I agree. I had to scratch my head for a moment at why a memset of "-1" would work at all on multi-byte types. I think it's better avoided in the name of readability and obviousness, not to mention the trap it leaves for items that don't sensibly initialize with it (like, say, pointers). As an aside, memset to 0 is _also_ undefined for pointers, but we long ago decided not to care, as no real-world systems have a problem with this. -Peff