This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Compiling byte-based switches as lookup tables


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]