Re: (trivia) remove useless typecast around `jif' variable
- From: Michael Tokarev <mjt@xxxxxxxxxx>
- Date: Mon, 05 Mar 2007 23:18:55 +0300
Jan Engelhardt wrote:
On Mar 5 2007 19:12, Michael Tokarev wrote:
Date: Mon, 5 Mar 2007 19:12:51 +0300 (MSK)
From: Michael Tokarev <mjt@xxxxxxxxxx>
To: undisclosed-recipients: ;
I have no clue what you sent it to, so I added linux-kernel again.
Oops.. I forgot to add the To: header (it was only sent to lkml).
][
In case we wanted to use different types, we would also have to
change the accompanying %lu into %llu. Only changing jif to u64 will
cause a problem, as the compiler does _not_ automatically
promote/demote types in varargs that already have a certain size. In
other words,
Sure thing, the change will be needed. But the thing is - with the
cast in place, compiler will be completely silent, while w/o the cast
it will produce a warning (or at least it's able to).
Generally, casts are bad, that's the point. Especially redundrand
ones like here.
As a side note, I dislike when people remove casts from functions
returning void*. For example,
struct somestruct *foo;
foo = (struct somestruct *)kmalloc(sizeof(struct somestruct));
With the cast in place, the compiler will warn if somestruct will
be changed to something else, but without the cast, the compiler
will happily accept the (now wrong) line.
[]
will throw a warning (rightfully if you ask me).
Yes, that's what i was referring to when said "let the compiler
do some work for us".
/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- References:
- (trivia) remove useless typecast around `jif' variable
- From: Michael Tokarev
- Re: (trivia) remove useless typecast around `jif' variable
- From: Jan Engelhardt
- (trivia) remove useless typecast around `jif' variable
- Prev by Date: Re: [patch] paravirt: VDSO page is essential
- Next by Date: Re: [patch] paravirt: VDSO page is essential
- Previous by thread: Re: (trivia) remove useless typecast around `jif' variable
- Next by thread: Re: (trivia) remove useless typecast around `jif' variable
- Index(es):
Relevant Pages
|