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: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 4DB2F1F619 for ; Tue, 3 Mar 2020 14:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728157AbgCCOQE (ORCPT ); Tue, 3 Mar 2020 09:16:04 -0500 Received: from pb-smtp20.pobox.com ([173.228.157.52]:51896 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbgCCOQE (ORCPT ); Tue, 3 Mar 2020 09:16:04 -0500 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 3F0CBC4751; Tue, 3 Mar 2020 09:16:02 -0500 (EST) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=G9+S2O8veHKHvP9BZTqoNCa5Bps=; b=ZskQgU ymh7mYY1o6xsd70dysHyTVBTgd2IYYVZwWLWRDK44J6t+Y4HRRSRKSy6v/yRZ/15 /8YMPBtYRNqvsMMDtFst0raJmpFrSo6WC7iICMD5xnLtG1xEwVMa08Xf1u8z5N29 mbQmhSGzpuYW5iAmGeV0GfhNlGRTK7jbPPPXQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=qzpjL0cRm+JP7fSkhRZeXNVYekmMyU4N 3qwOvPae+ykc4VxOwkaPwppR3U4TBptie437m55LvqqfTHp3XKDVZp3FhWYs7143 wXSVy2VjsuD3vlG8uXhPTrXvNbP5cCN5/u6OPlgg3qobtCi0QBQS+Ojl+Th4F213 LFqNZQs+muM= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 376EAC4750; Tue, 3 Mar 2020 09:16:02 -0500 (EST) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.76.80.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id 261EFC474D; Tue, 3 Mar 2020 09:15:59 -0500 (EST) (envelope-from junio@pobox.com) From: Junio C Hamano To: "Heba Waly via GitGitGadget" Cc: git@vger.kernel.org, Heba Waly Subject: Re: [PATCH v7 3/4] advice: revamp advise API References: Date: Tue, 03 Mar 2020 06:15:57 -0800 In-Reply-To: (Junio C. Hamano's message of "Mon, 02 Mar 2020 13:03:53 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 8157EE72-5D59-11EA-AEEF-B0405B776F7B-77302942!pb-smtp20.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Junio C Hamano writes: > "Heba Waly via GitGitGadget" writes: > >> +static struct { >> + const char *key; >> + int enabled; >> +} advice_setting[] = { >> + [ADVICE_ADD_EMBEDDED_REPO] = { "addEmbeddedRepo", 1 }, > > It would be nicer to future developers to flip the polarity, as we > do not have to write 1 all over the place, especially if we plan to > extend the structure over time and to use designated initializers > for only certain fields... Just to avoid needless churn, I think this does not matter in the longer term, so .enabled is OK as-is. The reason I say so is because, even though renaming to .disabled to allow initializers to default it to 0 is nicer for those who write the initializers manually, and it especially is true when we have more fields in the struct (we may add descriptive text so that we can issue an on-line help, for example), but I expect that would happen much later than we start generating these parts of the source code in two places (the initializer for advice_setting[] and the advice_type enum) from a single source by mechanical process. And the auto-generation will eliminate the burden of writing 1 manually.