From: Jeff Moyer on
Jiri Slaby <jslaby(a)suse.cz> writes:

> Return of the bi_rw tests is no longer bool after commit 74450be1. But
> results of such tests are stored in bools. This doesn't fit in there
> for some compilers (gcc 4.5 here), so either use !! magic to get real
> bools or use ulong where the result is assigned somewhere.
>
> Signed-off-by: Jiri Slaby <jslaby(a)suse.cz>
> Cc: Christoph Hellwig <hch(a)lst.de>
> Cc: Jens Axboe <axboe(a)kernel.dk>

Reviewed-by: Jeff Moyer <jmoyer(a)redhat.com>

Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Christoph Hellwig on
On Thu, Aug 12, 2010 at 02:31:06PM +0200, Jiri Slaby wrote:
> Return of the bi_rw tests is no longer bool after commit 74450be1. But
> results of such tests are stored in bools. This doesn't fit in there
> for some compilers (gcc 4.5 here), so either use !! magic to get real
> bools or use ulong where the result is assigned somewhere.

I'd have to look at my copy of the C standard if it's guaranteed, but
at least currently the values just get truncated down and bool still
is set to true. I'd much prefer just making these flags unsigned longs
instead of adding syntactic surage to make them true bools.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Jiri Slaby on
On 08/12/2010 06:08 PM, Christoph Hellwig wrote:
> On Thu, Aug 12, 2010 at 02:31:06PM +0200, Jiri Slaby wrote:
>> Return of the bi_rw tests is no longer bool after commit 74450be1. But
>> results of such tests are stored in bools. This doesn't fit in there
>> for some compilers (gcc 4.5 here), so either use !! magic to get real
>> bools or use ulong where the result is assigned somewhere.
>
> I'd have to look at my copy of the C standard if it's guaranteed,

�6.5.3.3 of ANSI C99, par 5:
The result of the logical negation operator ! is 0 if the value of its
operand compares unequal to 0, 1 if the value of its operand compares
equal to 0. The result has type int. The expression !E is equivalent to
(0==E).

On == (�6.5.9 par 3):
The == (equal to) and != (not equal to) operators are analogous to the
relational operators except for their lower precedence. Each of the
operators yields 1 if the specified relation is true and 0 if it is
false. The result has type int. For any pair of operands, exactly one of
the relations is true.

On bool => _Bool (�6.2.5 par 2)
An object declared as type _Bool is large enough to store the values 0
and 1.

So it should be safe :).

BTW just of curiosity, sizeof(bool) is 1 here (8 bits).

regards,
--
js
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/