Language standards vary (was Code Generation for Switch Statements)

Norman Diamond <diamond@jit081.enet.dec.com>
Wed, 27 May 1992 07:34:27 GMT

          From comp.compilers

Related articles
SUMMARY: Code Generation for Switch Statements spuler@coral.cs.jcu.edu.au (1992-05-25)
Language standards vary (was Code Generation for Switch Statements) diamond@jit081.enet.dec.com (Norman Diamond) (1992-05-27)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Norman Diamond <diamond@jit081.enet.dec.com>
Keywords: code, standards
Organization: Compilers Central
References: 92-05-135
Date: Wed, 27 May 1992 07:34:27 GMT

David Spuler quotes Hank Dietz:
>BTW, the C and Pascal constructs are VERY different -- and I'm not just
>talking about the fact that C cases can fall through. Pascal explicitly
>states that values not listed cause undefined behavior, whereas C promises
>that such values cause all cases to be skipped.


The C and Pascal standards are VERY different. Pascal explicity states that
values not listed cause dynamic violations, which MUST be diagnosed by
conforming implementations.


As a general rule, language standards vary immensely in the amount of error
checking that they require, and in what kind of misbehavior is allowed to
occur. It is advisable to RTFS.


-- Norman Diamond diamond@jit081.enet.dec.com
[Aha. So the switch code is really the same, except that in Pascal the
default case always goes to an error routine. -John]
--


Post a followup to this message

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