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:	Tue, 1 Apr 2008 22:00:03 +0200 (CEST)
From:	Jan Engelhardt <jengelh@...putergmbh.de>
To:	Dmitri Vorobiev <dmitri.vorobiev@...il.com>
cc:	Jonathan Corbet <corbet@....net>, linux-kernel@...r.kernel.org,
	torvalds@...ux-foundation.org,
	Randy Dunlap <randy.dunlap@...cle.com>
Subject: Re: [Pull] Some documentation patches


On Monday 2008-03-31 16:31, Dmitri Vorobiev wrote:
>> @@ -107,8 +107,8 @@ complete. Here's the example version:
>>
>>      static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
>>      {
>> -            loff_t *spos = (loff_t *) v;
>> -            *pos = ++(*spos);
>> +            loff_t *spos = v;
>> +            *pos = ++*spos;
>
> Excuse me, what's the point in this change and the next one? IMO, removing
> the explicit type cast makes the code less obvious.

Why should it be less obvious? Exactly left to the (loff_t *) you
already have loff_t *, so you know where you are going from v,
whose type is also obviously visible right in the line above.
Casts can hide errors. The cast is redundant, it does not
cover up a compiler warning. Even so, casts can hide programming
errors, as in http://jengelh.hopto.org/2007/0616-nocast.php .

> Relying upon operator priorities instead of explicit
> operator grouping using parentheses can confuse people, too.

In case of *a++ I would agree -- you would need to know whether * or
++ has the higher precedence (hint: ++ has). But in ++*a it does not
matter how much precedence either has, it always means the same.
Just like an arithmetic expression "x*-5".
--
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