9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] fun question
Date: Thu, 22 Jan 2009 18:01:37 -0500	[thread overview]
Message-ID: <87a5a6791443529cf29a59a55e5d7186@quanstro.net> (raw)
In-Reply-To: <dd6fe68a0901221454r2e9299edk31968f870640eb35@mail.gmail.com>

On Thu Jan 22 17:55:55 EST 2009, rsc@swtch.com wrote:
> >> <- is a unary operator.
>
> > okay, what does it do? (unless you meant -> in C++)
>
> it receives from a channel.

i assumed that ron was talking about c.
in c, "<- 0" tokenizes as "<", "-", and "0".
"-" is taken to be a unary operator on "0".

even gcc does this correctly:

; cat > x.c
#include <u.h>
#include <libc.h>

void
x(int seed)
{
	int m_31;

	m_31 = 1<<31;
	if(seed <- 0)
		seed = seed + m_31;
	print("seed %d\n", seed);
}

void
main(void)
{
	x(-5);
	exits("");
}
<eot>; 9c x.c
; 9l x.o
; ./a.out
seed -2147483648

- erik



  reply	other threads:[~2009-01-22 23:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-22 20:53 ron minnich
2009-01-22 21:40 ` erik quanstrom
2009-01-22 22:01 ` Russ Cox
2009-01-22 22:12   ` Pietro Gagliardi
2009-01-22 22:54     ` Russ Cox
2009-01-22 23:01       ` erik quanstrom [this message]
2009-01-22 23:17         ` ron minnich
2009-01-23  0:46         ` Pietro Gagliardi

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=87a5a6791443529cf29a59a55e5d7186@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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;
as well as URLs for NNTP newsgroup(s).