Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Jan 2018 11:08:19 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Conrad Meyer <cem@freebsd.org>, Pedro Giffuni <pfg@freebsd.org>,  src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r328486 - head/usr.bin/fortune/fortune
Message-ID:  <20180128102559.X4216@besplex.bde.org>
In-Reply-To: <1517094539.1517.9.camel@freebsd.org>
References:  <201801271743.w0RHh9io022619@repo.freebsd.org>  <CAG6CVpUOxtE9p8OApL6LsUJWh5tTM_9647M0qe5VNSnTTSEvQw@mail.gmail.com>  <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org>  <CAG6CVpXXUSPwUsxqXhJBfq_f-FwFAWXO4uQu4f2evWet90fBNg@mail.gmail.com> <1517094539.1517.9.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 27 Jan 2018, Ian Lepore wrote:

> On Sat, 2018-01-27 at 22:56 +0000, Conrad Meyer wrote:
>> I don=FFt think dragonfly has anything to do with this?=A0=A0If you=FFre
>> converting
>> bool increments to setting true values in FreeBSD, use
>> =B4true.=A1=A0=A0That=FFs all
>> there is to it.
>
> style(9) emphasizes internal consistancy in several places. =A0The
> uppercase TRUE/FALSE is currently the style within that code, so it
> makes sense to stick with it. =A0If a (somewhat gratuitous) conversion to
> the new style is made, it should be a separate commit just for that,
> emphasizing that it changes just style and not functionality.

fortune.c has already been churned and broken by gratuitous conversion to
use bool.

It used to use "#define bool short".  It also defined its own TRUE and FALS=
E
as 1 and 0.  This was almost correct.  The bools were sometimes set bogusly
to TRUE using the PDP-11 micro-optimization of incrementing them (this can
overflow in theory, but in practice it is hard to have enough command line
args to overflow even short variables by incrementing them by 1 per arg).
The `Debug' variable was tri-state, but its type was misspelled bool and
it was bogusly initialized to FALSE.

This was changed in r242576 by including <stdbool.h>, removing the private
definition of bool, and changing the definitions of TRUE and FALSE to true
and false.  This did no good, but exposed the brokenness of 'Debug' and
created mounds of style bugs (spelling true and false as TRUE and FALSE,
and requiring more magic for the PDP-11ism's to work).

r242577 increased the style bugs by using true and false directly in new
code.

'Debug' was fixed in r243036.

This commit is to remove the PDP11-isms.  Although they work even
better with real bools than with shorts (incrementing a bool clamps
it to 1, but incrementing a short always increments it unless it
overflows), they are larger obfuscations with bools than with shorts
and some compilers apparently warn about them.  This commit preserves
the old style of using TRUE and FALSE instead of true and false.

style(9) only mildly discourages converting old code to use bool ("may
be converted if it is reasonable to").  It says that the spellings
true and false are preferred, but should only say that the are preferred
in code that uses bool.

Bruce
From owner-svn-src-head@freebsd.org  Sun Jan 28 00:48:00 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D1EAECE8AC
 for <svn-src-head@mailman.ysv.freebsd.org>;
 Sun, 28 Jan 2018 00:48:00 +0000 (UTC) (envelope-from pfg@FreeBSD.org)
Received: from sonic303-37.consmr.mail.gq1.yahoo.com
 (sonic303-37.consmr.mail.gq1.yahoo.com [98.137.64.218])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id D90F782BD1
 for <svn-src-head@freebsd.org>; Sun, 28 Jan 2018 00:47:59 +0000 (UTC)
 (envelope-from pfg@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1517100478; bh=AWPF0i9iWL/UQxVh8OO9bU+hqEiP8A3VNKH2tnb2oi4=;
 h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject;
 b=IqEhrZMDHeptKzOdfW6JEZWHTft3Tpk03zmZfYAZEy3OEbxYQrSvrfOgiiAHMkGbL05Yktd9wGiSjdJNdUSF3ifGosGnRLlryde8YfJtnhKrTly07uDAUT+hLEmURgeG1gpiUa4C9xzdlrKYm+8wsjYCZFLD1mXleVVBy9fldtf6ZXzIQVh8ZQPurKLTbalc44dE9xFrIpPf9RHQrxKjtlGvOENOiYX9tutY21Nvlgh8MIgeIYFVvJ19JV5SHFdNPPSpB1OhTQLe7DG3jDxoT4K2Up+BukaC8B44jNpHnretBFwb/TB3byQmiqaKQEQIiMHdoralF/BdvR2xaHJVMg==
X-YMail-OSG: CPfRl_gVM1mBJOYtZQsQBx_DIX44GoJN9sGtwul2VEZjowzOVRgaiqlzRijVMO1
 Ux1vbz9maxlKMLlBdAZIpxi0tZ9sZA3RXIH9kdCVByuHaEZVQc4VGqp2NXiVTtw7v5x1JPE9mEUG
 dSSBafAigibM8lns350WSD2UHe5Y5asTErek6nvQUh8.6OhUKKNvBLXD6mA9evUr34XHNcKqAztK
 lFDXJKwBWWfIObu7nkySHoqdbg41vYVwtPOvMG_So_s1.EQ9lH_1UqdSdq9nPlMdstwDaYInmj.u
 .Ky0JWo9IVHnJQWcR1HbpBJhqgG_7WFFUy4UBkrfpogUup9NWMdVhjD2Rs5Quhz5YhZn9Gquv5Jf
 lza8_YdUteKkghvC0jVP_rByA8gTonVtUX5CheYgF3S83iN7SpGZlnvP87L21lryWN5o47pdz_6u
 dfWlVY6iK5gl4rPgTukO6wrOx9wARZUD9zaTsxVxIrvKFxgUEyewTbpljaClMeTN_bxcWRaYoorL
 ovnKHVeryMQ--
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic303.consmr.mail.gq1.yahoo.com with HTTP; Sun, 28 Jan 2018 00:47:58 +0000
Received: from smtp108.rhel.mail.gq1.yahoo.com (EHLO [192.168.0.8])
 ([216.39.57.224])
 by smtp412.mail.gq1.yahoo.com (JAMES SMTP Server ) with ESMTPA ID
 78660072d3a45406ef0ce1c26ec7eb04; 
 Sun, 28 Jan 2018 00:37:47 +0000 (UTC)
Subject: Re: svn commit: r328486 - head/usr.bin/fortune/fortune
To: Ian Lepore <ian@freebsd.org>, Conrad Meyer <cem@freebsd.org>
Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
References: <201801271743.w0RHh9io022619@repo.freebsd.org>
 <CAG6CVpUOxtE9p8OApL6LsUJWh5tTM_9647M0qe5VNSnTTSEvQw@mail.gmail.com>
 <1f1eb186-8f7b-6ec9-0970-d8b82b909e7b@FreeBSD.org>
 <CAG6CVpXXUSPwUsxqXhJBfq_f-FwFAWXO4uQu4f2evWet90fBNg@mail.gmail.com>
 <1517094539.1517.9.camel@freebsd.org>
From: Pedro Giffuni <pfg@FreeBSD.org>
Message-ID: <1ea5c2a1-c65c-09ef-558c-287657df4ba1@FreeBSD.org>
Date: Sat, 27 Jan 2018 19:37:45 -0500
User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101
 Thunderbird/52.5.2
MIME-Version: 1.0
In-Reply-To: <1517094539.1517.9.camel@freebsd.org>
Content-Type: text/plain; charset=iso-8859-13; format=flowed
Content-Transfer-Encoding: 8bit
Content-Language: en-US
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>;
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 28 Jan 2018 00:48:00 -0000



On 01/27/18 18:08, Ian Lepore wrote:
> On Sat, 2018-01-27 at 22:56 +0000, Conrad Meyer wrote:
>> I don�t think dragonfly has anything to do with this?��If you�re
>> converting
>> bool increments to setting true values in FreeBSD, use
>> �true.���That�s all
>> there is to it.
>>
>> Best,
>> Conrad
> style(9) emphasizes internal consistancy in several places. �The
> uppercase TRUE/FALSE is currently the style within that code, so it
> makes sense to stick with it. �If a (somewhat gratuitous) conversion to
> the new style is made, it should be a separate commit just for that,
> emphasizing that it changes just style and not functionality.

Indeed. I didn't want to mix FALSE with false and TRUE with true so I 
did the change as is to make the diff smaller and still have everything 
look consistent.

Further cleanups (DragonFly already did it) should be done in a 
different commit. I personally don't feel it's something important though.

Pedro.




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