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: case ranges in C++ (extension)


Michael Matz wrote:

Hi Mark,

GCC up to 3.3 accepted this:

 switch (i) {
   case 1 ... 10: /* bla */
 }

also in C++. This extension was dropped with the new parser. I don't
know if knowingly, but at least I don't find any deprecation messages. C
still accepts it. Would reimplementing this be accepted?


Yes.

I don't think I dropped that functionality intentionally, and we should probably support that extension for compatibility with GNU C. A "pedwarn" should be issued if "pedantic" is set, of course. You should test that it works in templates. You should also test that the code that checks for duplicate case values and such works correctly in the presence of this code.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com


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