Re: switch statement generation

ch+@cs.cmu.edu (Christopher Hoover)
Mon, 11 Apr 1994 16:41:21 GMT

          From comp.compilers

Related articles
switch statement generation dgaudet@undergrad.math.uwaterloo.ca (1994-04-06)
Re: switch statement generation mps@dent.uchicago.edu (1994-04-07)
switch statement generation dgaudet@undergrad.math.uwaterloo.ca (1994-04-07)
Re: switch statement generation henry@zoo.toronto.edu (1994-04-10)
Re: switch statement generation ch+@cs.cmu.edu (1994-04-11)
Re: switch statement generation ok@cs.rmit.oz.au (1994-04-13)
Re: switch statement generation ltd@netcom.com (1994-04-14)
Re: switch statement generation chase@Think.COM (1994-04-15)
| List of all articles for this month |

Newsgroups: comp.compilers
From: ch+@cs.cmu.edu (Christopher Hoover)
Keywords: code, optimize
Organization: School of Computer Science, Carnegie Mellon
References: 94-04-031 94-04-038
Date: Mon, 11 Apr 1994 16:41:21 GMT

Michael Spertus <mps@dent.uchicago.edu> wrote:
>I would like to see the keyword nodefault: added to switch statements.


Common Lisp has both CASE and ECASE. CASE is similar to C's switch
statement. ECASE is like CASE except that no explicit ``default:'' clause
is permitted, and if no clause is matched an error is signalled.


Henry Spencer <henry@zoo.toronto.edu> wrote:
>These are actually two separate notions, and arguably should not be
>bundled into the same construct. I dimly recall at least one language
>that had an "assert" statement (meaning "I think this is true here, let me
>know if you discover it's not") and an "assume" statement (meaning "this
>is true here, for sure, whether it looks that way or not, and you may rely
>on it for optimization or assertion checking").


Common Lisp has both of these notions. The ASSERT macro gives you the
moral equivalent of C's assert macro as found in <assert.h>. Common Lisp
declarations on the other hand usually tell the compiler to assume certain
things -- often things it cannot otherwise figure out.


-- Chris.
(ch@lks.csi.com)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.