home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / compiler / 1260 < prev    next >
Encoding:
Text File  |  1992-07-23  |  1.8 KB  |  42 lines

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!wupost!think.com!spdcc!iecc!compilers-sender
  3. From: henry@zoo.toronto.edu (Henry Spencer)
  4. Subject: Re: Pros and cons of high-level intermediate languages
  5. Reply-To: henry@zoo.toronto.edu (Henry Spencer)
  6. Organization: U of Toronto Zoology
  7. Date: Thu, 23 Jul 1992 17:03:03 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-07-081@comp.compilers>
  10. Keywords: C, optimize
  11. References: <92-07-064@comp.compilers> <92-07-073@comp.compilers>
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 27
  14.  
  15. shankar@sgi.com (Shankar Unni) writes:
  16. >This is totally bogus. Let us assume that the ANSI spec were to say: local
  17. >variables are guaranteed to retain their values when a longjmp() takes you
  18. >back to the stack.
  19. >
  20. >Now how would this be done on a machine with several registers ...
  21.  
  22. The right way to do it is to have the compiler recognize the presence of
  23. setjmp() -- ANSI C carefully restricts setjmp() usage so this is
  24. guaranteed to be possible -- and take suitable precautions.
  25.  
  26. That is a little tricky in a simple one-pass compiler.  What such a
  27. compiler can do, however, is note the presence of the <setjmp.h> header,
  28. and take worst-case precautions for code compiled with that header
  29. visible.
  30.  
  31. Historical practice is to say that variables marked "register" can lose
  32. their values, and others can't.  Any compiler smart enough to silently
  33. promote variables into registers ought to be able to handle one of the
  34. above strategies.
  35.  
  36. And yes, some of us said these things to X3J11, but they didn't listen...
  37. -- 
  38. Henry Spencer @ U of Toronto Zoology, henry@zoo.toronto.edu  utzoo!henry
  39. -- 
  40. Send compilers articles to compilers@iecc.cambridge.ma.us or
  41. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  42.