All of lore.kernel.org
 help / color / mirror / Atom feed
From: Derek M Jones <derek@knosof.co.uk>
To: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
Cc: Harvey Harrison
	<harvey.harrison-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Christopher Li <sparse-55XgFHCVCFZAfugRpC6u6w@public.gmane.org>,
	Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>,
	yi.zhu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Alexander Viro <viro-rfM+Q5joDG/XmaaqVzeoHQ@public.gmane.org>,
	linux-sparse-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Josh Triplett <josh-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org>
Subject: Re: [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct
Date: Wed, 05 Mar 2008 12:13:28 +0000	[thread overview]
Message-ID: <47CE8E68.5060701@knosof.co.uk> (raw)
In-Reply-To: <20080305081904.GA17789-X9Un+BFzKDI@public.gmane.org>

All,

>>> i think there might be similar patterns: "x & !y", "!x | y", "x | !y" ?
>>>
>> Well, (!x & y) and (!x | y) are probably the two that might have been 
>> intended otherwise.  (x & !y), (x | !y) are probably ok.
> 
> i think the proper intention in the latter cases is (x & ~y) and
> (x | ~y).
> 
> My strong bet is that in 99% of the cases they are real bugs and && or 
> || was intended.

Developer knowledge of operator precedence and the issue of what
they intended to write are interesting topics.  Some experimental
work is described in (binary operators only I'm afraid):

www.knosof.co.uk/cbook/accu06a.pdf
www.knosof.co.uk/cbook/accu07a.pdf

The ACCU 2006 experiment provides evidence that developer knowledge
is proportional to the number of occurrences of a construct in
source code, it also shows a stunningly high percentage of incorrect
answers.

The ACCU 2007 experiment provides evidence that the names of the
operands has a significant impact on operator precedence choice.

I wonder what kind of names are used as the operand of unary
operators?

I would expect the ~ operator to have a bitwise name, but the
! operator might have an arithmetic or bitwise name.

-- 
Derek M. Jones                              tel: +44 (0) 1252 520 667
Knowledge Software Ltd                      mailto:derek@knosof.co.uk
Applications Standards Conformance Testing    http://www.knosof.co.uk

WARNING: multiple messages have this Message-ID (diff)
From: Derek M Jones <derek-Qjv84pu2YCLQXOPxS62xeg@public.gmane.org>
To: Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>
Cc: Harvey Harrison
	<harvey.harrison-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Christopher Li <sparse-55XgFHCVCFZAfugRpC6u6w@public.gmane.org>,
	Julia Lawall <julia-dAYI7NvHqcQ@public.gmane.org>,
	yi.zhu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Alexander Viro <viro-rfM+Q5joDG/XmaaqVzeoHQ@public.gmane.org>,
	linux-sparse-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Josh Triplett <josh-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org>
Subject: Re: [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and &
Date: Wed, 05 Mar 2008 12:13:28 +0000	[thread overview]
Message-ID: <47CE8E68.5060701@knosof.co.uk> (raw)
In-Reply-To: <20080305081904.GA17789-X9Un+BFzKDI@public.gmane.org>

All,

>>> i think there might be similar patterns: "x & !y", "!x | y", "x | !y" ?
>>>
>> Well, (!x & y) and (!x | y) are probably the two that might have been 
>> intended otherwise.  (x & !y), (x | !y) are probably ok.
> 
> i think the proper intention in the latter cases is (x & ~y) and
> (x | ~y).
> 
> My strong bet is that in 99% of the cases they are real bugs and && or 
> || was intended.

Developer knowledge of operator precedence and the issue of what
they intended to write are interesting topics.  Some experimental
work is described in (binary operators only I'm afraid):

www.knosof.co.uk/cbook/accu06a.pdf
www.knosof.co.uk/cbook/accu07a.pdf

The ACCU 2006 experiment provides evidence that developer knowledge
is proportional to the number of occurrences of a construct in
source code, it also shows a stunningly high percentage of incorrect
answers.

The ACCU 2007 experiment provides evidence that the names of the
operands has a significant impact on operator precedence choice.

I wonder what kind of names are used as the operand of unary
operators?

I would expect the ~ operator to have a bitwise name, but the
! operator might have an arithmetic or bitwise name.

-- 
Derek M. Jones                              tel: +44 (0) 1252 520 667
Knowledge Software Ltd                      mailto:derek-Qjv84pu2YCLQXOPxS62xeg@public.gmane.org
Applications Standards Conformance Testing    http://www.knosof.co.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Derek M Jones <derek@knosof.co.uk>
To: Ingo Molnar <mingo@elte.hu>
Cc: Harvey Harrison <harvey.harrison@gmail.com>,
	Christopher Li <sparse@chrisli.org>, Julia Lawall <julia@diku.dk>,
	yi.zhu@intel.com, linux-wireless@vger.kernel.org,
	ipw3945-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Alexander Viro <viro@ftp.linux.org.uk>,
	linux-sparse@vger.kernel.org,
	Josh Triplett <josh@freedesktop.org>
Subject: Re: [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and &
Date: Wed, 05 Mar 2008 12:13:28 +0000	[thread overview]
Message-ID: <47CE8E68.5060701@knosof.co.uk> (raw)
In-Reply-To: <20080305081904.GA17789@elte.hu>

All,

>>> i think there might be similar patterns: "x & !y", "!x | y", "x | !y" ?
>>>
>> Well, (!x & y) and (!x | y) are probably the two that might have been 
>> intended otherwise.  (x & !y), (x | !y) are probably ok.
> 
> i think the proper intention in the latter cases is (x & ~y) and
> (x | ~y).
> 
> My strong bet is that in 99% of the cases they are real bugs and && or 
> || was intended.

Developer knowledge of operator precedence and the issue of what
they intended to write are interesting topics.  Some experimental
work is described in (binary operators only I'm afraid):

www.knosof.co.uk/cbook/accu06a.pdf
www.knosof.co.uk/cbook/accu07a.pdf

The ACCU 2006 experiment provides evidence that developer knowledge
is proportional to the number of occurrences of a construct in
source code, it also shows a stunningly high percentage of incorrect
answers.

The ACCU 2007 experiment provides evidence that the names of the
operands has a significant impact on operator precedence choice.

I wonder what kind of names are used as the operand of unary
operators?

I would expect the ~ operator to have a bitwise name, but the
! operator might have an arithmetic or bitwise name.

-- 
Derek M. Jones                              tel: +44 (0) 1252 520 667
Knowledge Software Ltd                      mailto:derek@knosof.co.uk
Applications Standards Conformance Testing    http://www.knosof.co.uk

  parent reply	other threads:[~2008-03-05 12:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 20:44 [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of Julia Lawall
2008-02-26 20:44 ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Julia Lawall
2008-02-26 22:47 ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of.and & Tomas Winkler
2008-02-26 22:47   ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Tomas Winkler
2008-02-27  0:59   ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct John W. Linville
2008-02-27  0:59     ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & John W. Linville
     [not found] ` <Pine.LNX.4.64.0802262143570.18200-QfmoRoYWmW9knbxzx/v8hQ@public.gmane.org>
2008-03-05  6:38   ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Ingo Molnar
2008-03-05  6:38     ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Ingo Molnar
2008-03-05  6:38     ` Ingo Molnar
2008-03-05  6:49     ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of.and & Christopher Li
2008-03-05  6:49       ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Christopher Li
2008-03-05  7:02       ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Ingo Molnar
2008-03-05  7:02         ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Ingo Molnar
     [not found]         ` <20080305070201.GA32434-X9Un+BFzKDI@public.gmane.org>
2008-03-05  7:09           ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Harvey Harrison
2008-03-05  7:09             ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Harvey Harrison
2008-03-05  7:09             ` Harvey Harrison
2008-03-05  8:19             ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Ingo Molnar
2008-03-05  8:19               ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Ingo Molnar
     [not found]               ` <20080305081904.GA17789-X9Un+BFzKDI@public.gmane.org>
2008-03-05 12:13                 ` Derek M Jones [this message]
2008-03-05 12:13                   ` Derek M Jones
2008-03-05 12:13                   ` Derek M Jones
2008-03-05  8:55           ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Julia Lawall
2008-03-05  8:55             ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Julia Lawall
2008-03-05  8:55             ` Julia Lawall
2008-03-05 12:20             ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Ingo Molnar
2008-03-05 12:20               ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Ingo Molnar
     [not found]               ` <20080305122010.GA999-X9Un+BFzKDI@public.gmane.org>
2008-03-05 12:30                 ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of.and & Bart Van Assche
2008-03-05 12:30                   ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Bart Van Assche
2008-03-05 12:30                   ` Bart Van Assche
     [not found]                   ` <e2e108260803050430o317d3e0dyed50e86cc4569746-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-05 12:36                     ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Ingo Molnar
2008-03-05 12:36                       ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Ingo Molnar
2008-03-05 12:36                       ` Ingo Molnar
2008-03-05 12:35                 ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct Julia Lawall
2008-03-05 12:35                   ` [PATCH 6/9] drivers/net/wireless/iwlwifi/iwl-4965.c: Correct use of ! and & Julia Lawall
2008-03-05 12:35                   ` Julia Lawall

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=47CE8E68.5060701@knosof.co.uk \
    --to=derek@knosof.co.uk \
    --cc=harvey.harrison-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=ipw3945-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=josh-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org \
    --cc=julia-dAYI7NvHqcQ@public.gmane.org \
    --cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sparse-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mingo-X9Un+BFzKDI@public.gmane.org \
    --cc=sparse-55XgFHCVCFZAfugRpC6u6w@public.gmane.org \
    --cc=viro-rfM+Q5joDG/XmaaqVzeoHQ@public.gmane.org \
    --cc=yi.zhu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.