The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: dmr@plan9.bell-labs.com (Dennis Ritchie)
Subject: [pups] V7 setjmp/longjmp
Date: Tue, 25 Mar 2003 00:14:53 -0500	[thread overview]
Message-ID: <8b42de71c97729c28a22c46456004471@plan9.bell-labs.com> (raw)

Helbig remarked (quoting Davidson):

 > >Yes, you are right - V7 restores the register variables to a state which
 > >is consistent with the other auto variables in the function - ie the value
 > >which they had when longjmp was called.
 > >
 > >The caveats about not relying on register variables applied to V6.

 > Nope, even in V6, register variables are restored to the values they had
 > when reset(III) was called! (reset() is the name of longjmp() in V6).
 > By the way, reset() is much smaller than longjmp() but provides the same
 > functionality.

 > I wonder why longjmp() was rewritten.

Setjmp/longjmp do more (setjmp returns different values
for the initial call and the longjmp-invoked one).
But the thing that would become more important
is that the PDP-11 compiler's calling sequence was
especially friendly toward restoring register values--
it just worked automatically.

Other machines and compilers were not so friendly.
This is why ANSI and ISO had to put in special rules
about promising to preserve only things marked
volatile.

We've been through this before.

	Dennis





             reply	other threads:[~2003-03-25  5:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-25  5:14 Dennis Ritchie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-23 12:32 Wolfgang Helbig
2002-12-31 11:04 Wolfgang Helbig
2002-12-31 16:02 ` Michael Davidson
2002-12-30 18:51 bwc
2002-12-31  2:23 ` Michael Davidson

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=8b42de71c97729c28a22c46456004471@plan9.bell-labs.com \
    --to=dmr@plan9.bell-labs.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).