This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: Request of new __attribute__ for switch statements (elimination of the bounds check)


> > >   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


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