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: Switch statement case range


On Sun, Apr 08, 2012 at 08:59:46AM -0700, Rick Hodgin wrote:
> What are the possibilities of adding a GCC extension to allow:
> 
> switch (foo) {
> case 1:
> case 2:
> case 3 to 8:
> case 9:
> default:
> }

This already exists (and is a GNU extension):

  switch (foo)
    {
    case 1:
      break;
    case 3 ... 8:
      break;
    default:
      break;
    }

	Marek


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