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: Tim Hollebeek <tim at hollebeek dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: Kevin Lawton <kevinlawton2001 at yahoo dot com>, Zack Weinberg <zack at codesourcery dot com>, Jamie Lokier <egcs at tantalophile dot demon dot co dot uk>, gcc at gcc dot gnu dot org
- Date: Wed, 16 Oct 2002 13:14:37 -0700
- Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check)
- References: <20021015191724.A21405@hollebeek.com> <Pine.LNX.4.33.0210161042100.20702-100000@wotan.suse.de>
- Reply-to: tim at hollebeek dot com
> > > switch (a & 0x3) {
> >
> > then ask for the compiler to understand and DTRT with this syntax,
> > instead of some funky attribute.
>
> Although remember that we have two cases in this thread. Things like
> fully populated "switch (a & A_CONSTANT)" or "switch (a_char)", which
> clearly should be optimized by the compiler itself without syntantic help.
>
> And that "switch (an_enum)" thing, also "fully populated" in the sense
> that all enumeration values are mentioned.
Cases like that that are performance critical, not a factor of two,
and cannot be expanded to a factor of two? I don't buy it.
Remember, we already have -Wswitch, and default: abort(), which are
adequate for all but the most performance intensive cases.
-Tim