Re: [patch 1/1] consolidate TRUE and FALSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>Is it any good?
>
Depends.

	20:51 shanghai:/dev/shm > cat bool.c
	#include <stdio.h>

	int main(void) {
	    _Bool x = 0;
	    x += 2;
	    printf("%d\n", x);
	}
	20:51 shanghai:/dev/shm > gcc bool.c && ./a.out
	1


It can't "overflow". If that's good or not I can't tell, and I can only 
imagine an artifical scenario where it affects things:


	void do_something_wrong(int *x) {
		*x += 2;
	}

	int x = 0;
	do_something_wrong(&x);
	if(x & 1)
		printf("x & 1");


>From this one, we would expect nothing to be printed. But if x was a _Bool 
x (and _Bool *x, respectively), something would be printed.



Jan Engelhardt
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux