Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 2015 22:49:57 -0500
From:      Pedro Giffuni <pfg@FreeBSD.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r283088 - head/sys/ddb
Message-ID:  <406A7AE3-1891-4B2C-B917-14C150EBBAB5@FreeBSD.org>
In-Reply-To: <20150519113755.U1840@besplex.bde.org>
References:  <201505182227.t4IMRljx078812@svn.freebsd.org> <20150519113755.U1840@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> Il giorno 18/mag/2015, alle ore 20:48, Bruce Evans =
<brde@optusnet.com.au> ha scritto:
>=20
> On Mon, 18 May 2015, Pedro F. Giffuni wrote:
>=20
>> Log:
>> ddb: stop boolean screaming.
>>=20
>> TRUE --> true
>> FALSE--> false
>>=20
>> Hinted by:	NetBSD
>=20
> This is not just churn to a style regression, but a type mismatch.
>=20

It is an attempt to reduce differences with NetBSD.

One of the complaints of hear from newcomers to the ddb code is that
the format is old-fashioned (it still had pre-ANSI headers not long ago)
and unmaintained.

>> Modified: head/sys/ddb/db_break.c
>> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
>> --- head/sys/ddb/db_break.c	Mon May 18 22:14:06 2015	=
(r283087)
>> +++ head/sys/ddb/db_break.c	Mon May 18 22:27:46 2015	=
(r283088)
>> @@ -155,12 +155,12 @@ db_find_breakpoint_here(db_addr_t addr)
>> 	return db_find_breakpoint(db_map_addr(addr), addr);
>> }
>>=20
>> -static boolean_t	db_breakpoints_inserted =3D TRUE;
>> +static boolean_t	db_breakpoints_inserted =3D true;
>=20
> This code hasn't been churned to use the boolean type.  It still uses
> boolean_t, which is plain int.  TRUE and FALSE go with this type.  =
true
> and false go with the boolean type.  This probably makes no =
difference,
> because TRUE happens to be implemented with the same value as true and
> there are lots of implicit versions between the types.
>=20

Yes, I noticed the return types are still ints. It doesn=E2=80=99t look =
difficult
to convert it to use a real boolean type.  In any case, I would prefer =
to go
forward (using bool) instead of reverting this change.

> The boolean type is almost useless since C's type system is too weak =
to
> distinguish between plain int used as a boolean and pure boolean.  If
> it were stronger, then it would complain about all the implicit =
conversions
> between int and boolean, and the boolean type would be harder to use =
for
> other reasons.
>=20

And I would like that to happen, but it would probably break a lot of =
legacy code.
I thought boolean_t was a transition type.


Pedro.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?406A7AE3-1891-4B2C-B917-14C150EBBAB5>