Compiling byte-based switches as lookup tables

Reuben Thomas rrt@persephone.al.cl.cam.ac.uk
Sat Feb 28 23:38:00 GMT 1998


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



More information about the Cygwin mailing list