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: dewar at gnat dot com (Robert Dewar)
- To: kevinlawton2001 at yahoo dot com, matz at suse dot de, zack at codesourcery dot com
- Cc: egcs at tantalophile dot demon dot co dot uk, gcc at gcc dot gnu dot org
- Date: Tue, 15 Oct 2002 21:41:21 -0400 (EDT)
- Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check)
> > It's just that I see removing the bounds checks on a switch statement
> > as a marginal optimization compared to the risk. I've never seen a
> > switch be the bottleneck in anything.
I find this a remkarable attitude for a C compiler :-)
Even Ada allows the programmer to remove all checks if that is what the
programmer wants!
After all in a safety critical program, such checks would not be permitted,
because you simply cannot have a check that always succeeds, and whose
failure branch is therefore deactivated code.