Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Apr 2022 15:14:49 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        "mjg@freebsd.org" <mjg@FreeBSD.org>, dev-commits-src-main@freebsd.org
Subject:   Re: git: b40c0db6f6d6 - main - Patch up __diagused for when only one of INVARIANTS or WITNESS is defined
Message-ID:  <775952BB-DEE3-4052-BF42-D04A7A672C22@yahoo.com>
References:  <775952BB-DEE3-4052-BF42-D04A7A672C22.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Just a suggestion . . .

For:

QUOTE
+#elif ((defined(INVARIANTS) && !defined(WITNESS)) || \
+	(!defined(INVARIANTS) && defined(WITNESS)))
 #define	__diagused	__unused
END QUOTE

something like the following seems far more direct to me:

+#elif defined(INVARIANTS) != defined(WITNESS)
 #define	__diagused	__unused

Boolean == and != are well defined, even in languages
where Boolean is fully distinct from numeric types.
Expressing everything via NOT, AND, and possible OR
makes various notations messy for simple concepts.

Hardware folks call != by the name XOR instead of
inequality.

Equal length "vectors" of Booleans have != and XOR being
distinct, XOR being a "Booleanwise" (bitwise) != producing
a vector of Booleans, the resulting vector again being of
matching length. By contrast != for equal length vectors
of Booleans producing just one overall Boolean for if the
count of non-matching Booleans in an XOR would be
positive (TRUE) vs. zero (FALSE).

Food for thought.

===
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?775952BB-DEE3-4052-BF42-D04A7A672C22>