lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 05 Mar 2007 23:18:55 +0300
From:	Michael Tokarev <mjt@....msk.ru>
To:	Jan Engelhardt <jengelh@...ux01.gwdg.de>
CC:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: (trivia) remove useless typecast around `jif' variable

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@....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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ