The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: scj@yaccman.com (scj@yaccman.com)
Subject: [TUHS] Documentation on B language?
Date: Thu, 10 Mar 2016 10:09:34 -0800	[thread overview]
Message-ID: <b6d1606dc5b03276bbffccba5827f6bb.squirrel@webmail.yaccman.com> (raw)
In-Reply-To: <20160309214302.GC9515@mercury.ccil.org>

From the standpoint of a compiler writer, the increment operators (and
later, similar operators like &=) were surprisingly painful, on two
levels.

The first problem is that there were lots of nasty interactions between
these operators and function calls.  Consider gems like:
     f( ++i, ++i );
     f( ++i, i++ );
     f( i++, ++i );
     f( i++, i++ );
The "natural" behavior depended critically on whether the stack grew
upwards or downwards.  Add to this the delights that arose if i was an
external variable that was also referenced (or changed) within f.  This
may seem like an unlikely event, but it happened all time when the macro
implementation of getchar was introduced.

The second problem was that most victims of the above had a lot of
difficulty, at least the first time, in understanding what the bug was and
tracking it down...  And many considered the behavior they saw a compiler
bug (no mater what the documentation and/or the Standard said about
"undefined")...





  reply	other threads:[~2016-03-10 18:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 21:34 Doug McIlroy
2016-03-09 21:43 ` John Cowan
2016-03-10 18:09   ` scj [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-03-09 12:34 Noel Chiappa
2016-03-08 13:01 Doug McIlroy
2016-03-08 18:00 ` John Cowan
2016-03-08 19:10   ` Andru Luvisi
2016-03-08 19:43     ` John Cowan
2016-03-08 23:13       ` Tim Bradshaw
2016-03-09 11:09   ` Christian Neukirchen
2016-03-09 11:29     ` Brantley Coile
2016-03-07  0:57 Norman Wilson
2016-03-07  8:39 ` Angelo Papenhoff
2016-03-07  0:20 Warren Toomey

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=b6d1606dc5b03276bbffccba5827f6bb.squirrel@webmail.yaccman.com \
    --to=scj@yaccman.com \
    /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).