Re: Large block device patch, part 1 of 9

Peter Chubb (peter@chubb.wattle.id.au)
Wed, 28 Aug 2002 09:40:12 +1000


>>>>> "Ben" == Benjamin LaHaise <bcrl@redhat.com> writes:

Ben> On Tue, Aug 27, 2002 at 03:23:04PM +0000, Pavel Machek wrote:
>> Hi!
>>
>> > Then the following works properly without ugly casts or warnings:
>> >
>> > __u64 val = 1;
>> >
>> > printk("at least "PFU64" of your u64s are belong to us\n", val);
>>
>> Casts are ugly but this looks even worse. I'd go for casts.

Ben> Casts override the few type checking abilities the compiler gives
Ben> us. At least with the PFU64 style, we'll get warnings when
Ben> someone changes a variable into a pointer without remembering to
Ben> update the printk.

We did go through all this after the first or second incarnation of
this patch, back in May. After going around in circles for a bit, the
use of casts seemed then to win the day.

If Linus has a major objection I'll redo things.

The main advantage of casts, to me at present, is it allows the
patches to be incremental. Not all places that should be sector_t are
yet --- some are int, and some are long. Casting them all to unsigned
long long and printing with %llu works now, before all the places are
changed (in patch 3 or 4 IIRC).

See the thread that starts at
http://marc.theaimsgroup.com/?l=linux-kernel&m=102100347212072&w=2

--
Dr Peter Chubb				    peterc@gelato.unsw.edu.au
You are lost in a maze of BitKeeper repositories, all almost the same.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/