On Sun, Oct 16, 2016 at 07:07:36AM -0600, Todd C. Miller wrote:
> It is effectively the same in this case but using the boolean OR
> is less surprising and may quiet over zealous compilers.
Are you sure? For example, in cvs/diff3.c
t2 is not always initialized with this change.
-Otto
>
> OK?
>
> - todd
>
> Index: cvs/diff3.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/cvs/diff3.c,v
> retrieving revision 1.61
> diff -u -p -u -r1.61 diff3.c
> --- cvs/diff3.c 16 Oct 2016 13:03:40 -0000 1.61
> +++ cvs/diff3.c 16 Oct 2016 13:05:33 -0000
> @@ -543,7 +543,7 @@ merge(size_t m1, size_t m2)
> d1 = d13;
> d2 = d23;
> j = 0;
> - while ((t1 = (d1 < d13 + m1)) | (t2 = (d2 < d23 + m2))) {
> + while ((t1 = (d1 < d13 + m1)) || (t2 = (d2 < d23 + m2))) {
> if (debug) {
> printf("%d,%d=%d,%d %d,%d=%d,%d\n",
> d1->old.from, d1->old.to,
> Index: diff3/diff3prog.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/diff3/diff3prog.c,v
> retrieving revision 1.18
> diff -u -p -u -r1.18 diff3prog.c
> --- diff3/diff3prog.c 16 Oct 2016 13:03:40 -0000 1.18
> +++ diff3/diff3prog.c 16 Oct 2016 13:05:33 -0000
> @@ -301,7 +301,7 @@ merge(int m1, int m2)
> d1 = d13;
> d2 = d23;
> j = 0;
> - while ((t1 = (d1 < d13 + m1)) | (t2 = (d2 < d23 + m2))) {
> + while ((t1 = (d1 < d13 + m1)) || (t2 = (d2 < d23 + m2))) {
> if (debug) {
> printf("%d,%d=%d,%d %d,%d=%d,%d\n",
> d1->old.from,d1->old.to,
> Index: rcs/diff3.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/rcs/diff3.c,v
> retrieving revision 1.39
> diff -u -p -u -r1.39 diff3.c
> --- rcs/diff3.c 26 Aug 2016 09:02:54 -0000 1.39
> +++ rcs/diff3.c 16 Oct 2016 13:05:33 -0000
> @@ -636,7 +636,7 @@ merge(size_t m1, size_t m2)
> d1 = d13;
> d2 = d23;
> j = 0;
> - while ((t1 = (d1 < d13 + m1)) | (t2 = (d2 < d23 + m2))) {
> + while ((t1 = (d1 < d13 + m1)) || (t2 = (d2 < d23 + m2))) {
> if (debug) {
> printf("%d,%d=%d,%d %d,%d=%d,%d\n",
> d1->old.from, d1->old.to,