linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@bonn-fries.net>
To: Tobias Ringstrom <tori@tellus.mine.nu>,
	"David S. Miller" <davem@redhat.com>
Cc: Jonathan Morton <chromi@cyberspace.org>,
	BERECZ Szabolcs <szabi@inf.elte.hu>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: page_launder() bug
Date: Mon, 7 May 2001 15:49:15 +0200	[thread overview]
Message-ID: <01050715491500.08789@starship> (raw)
In-Reply-To: <Pine.LNX.4.33.0105070823060.24073-100000@svea.tellus>

On Monday 07 May 2001 08:26, Tobias Ringstrom wrote:
> On Sun, 6 May 2001, David S. Miller wrote:
> > It is the most straightforward way to make a '1' or '0'
> > integer from the NULL state of a pointer.
>
> But is it really specified in the C "standards" to be exctly zero or
> one, and not zero and non-zero?

Yes, and if we did not have this stupid situation where the C language 
standard is not freely available online then you would not have had to 
ask.</rant>

> IMHO, the ?: construct is way more readable and reliable.

There is no difference in reliability.  Readability is a matter of 
opinion - my opinion is that they are equally readable.  To its credit, 
gcc produces the same ia32 code in either case:

	int foo = 999;
	return 1 + !!foo;

<main+6>:	movl   $0x3e7,0xfffffffc(%ebp)
<main+13>:	cmpl   $0x0,0xfffffffc(%ebp)
<main+17>:	je     0x80483e0 <main+32>
<main+19>:	mov    $0x2,%eax
<main+24>:	jmp    0x80483e5 <main+37>
<main+26>:	lea    0x0(%esi),%esi
<main+32>:	mov    $0x1,%eax
<main+37>:	mov    %eax,%eax

	int foo = 999;
	return foo? 2: 1;

<main+6>:	movl   $0x3e7,0xfffffffc(%ebp)
<main+13>:	cmpl   $0x0,0xfffffffc(%ebp)
<main+17>:	je     0x80483e0 <main+32>
<main+19>:	mov    $0x2,%eax
<main+24>:	jmp    0x80483e5 <main+37>
<main+26>:	lea    0x0(%esi),%esi
<main+32>:	mov    $0x1,%eax
<main+37>:	mov    %eax,%eax

--
Daniel
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

  parent reply	other threads:[~2001-05-07 13:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-06 21:08 BERECZ Szabolcs
2001-05-06 21:59 ` Jonathan Morton
2001-05-06 22:07   ` BERECZ Szabolcs
2001-05-07  4:55   ` David S. Miller
2001-05-07  5:19     ` Aaron Lehmann
2001-05-07  6:26     ` Tobias Ringstrom
2001-05-07  8:54       ` David S. Miller
2001-05-07 15:12         ` Tobias Ringstrom
2001-05-07 10:52       ` Alan Cox
2001-05-07 13:49       ` Daniel Phillips [this message]
2001-05-07 14:52     ` Horst von Brand
2001-05-09  2:32     ` Rusty Russell
2001-05-09  3:36       ` Jonathan Morton
2001-05-09  8:43       ` Martin Dalecki

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=01050715491500.08789@starship \
    --to=phillips@bonn-fries.net \
    --cc=chromi@cyberspace.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=szabi@inf.elte.hu \
    --cc=tori@tellus.mine.nu \
    /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