This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Request of new __attribute__ for switch statements (elimination of the bounds check)
- From: Richard Zidlicky <rz at linux-m68k dot org>
- To: Kevin Lawton <kevinlawton2001 at yahoo dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 13 Oct 2002 23:58:37 +0200
- Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check)
- References: <20021011190521.57024.qmail@web80309.mail.yahoo.com>
On Fri, Oct 11, 2002 at 12:05:21PM -0700, Kevin Lawton wrote:
> All,
>
> For implementation of machine simulators, it's quite common
> to have completely populated switch statements on byte values:
>
> unsigned char byte;
>
> switch (byte) {
> case 0:
> case 1:
> ...
> case 255:
> }
>
> But I don't know of any way to tell the compiler to _not_ generate
> a bounds check on the switch variable 'byte'. All of the target
> space is covered.
did you look into using gcc's computed goto?
Richard