This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Compiling byte-based switches as lookup tables
- To: help-gcc at gnu dot org
- Subject: Compiling byte-based switches as lookup tables
- From: rrt at persephone dot al dot cl dot cam dot ac dot uk (Reuben Thomas)
- Date: 20 Oct 1999 10:59:23 GMT
- Newsgroups: gnu.gcc.help
- Organization: University of Cambridge
- Reply-To: rrt at sc3d dot org
- Xref: wodc7nx0 gnu.gcc.help:1477
Is it possible to make GNU C compile a switch whose switch value is
byte-sized (e.g. a char in most implementations) into a lookup table without
a bounds check. I'm implementing a byte-code interpreter. Since I want to
write pure ANSI C, I can't use any GNU tricks like computed gotos.
I'm using egcs 2.91 on the Pentium.
(I'd appreciate replies CCed by email, as I don't usually read this group,
but understand entirely if you don't feel like it.)
--
http://sc3d.org/rrt/ | certain, a. insufficiently analysed