From: Michael Tokarev <mjt@tls.msk.ru>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: (trivia) remove useless typecast around `jif' variable
Date: Mon, 05 Mar 2007 23:18:55 +0300 [thread overview]
Message-ID: <45EC7B2F.4040400@tls.msk.ru> (raw)
In-Reply-To: <Pine.LNX.4.61.0703051724520.24366@yvahk01.tjqt.qr>
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@tls.msk.ru>
>> 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
next prev parent reply other threads:[~2007-03-05 20:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-05 16:12 (trivia) remove useless typecast around `jif' variable Michael Tokarev
2007-03-05 16:29 ` Jan Engelhardt
2007-03-05 20:18 ` Michael Tokarev [this message]
[not found] ` <663650480-1173118082-cardhu_blackberry.rim.net-718749525-@bxe041-cell01.bisx.prod.on.blackberry>
2007-03-05 22:58 ` Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45EC7B2F.4040400@tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=jengelh@linux01.gwdg.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox