This is the mail archive of the gcc-patches@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: [PATCH]: Don't apply default conversions to C switch expressions



On Monday, December 10, 2001, at 05:04 PM, Roger Sayle wrote:

>
> From my reading of the draft C99 rationale document, section 6.8.4.2 on
> page 84 states that "case labels are first converted to the type of the
> controlling expression of the switch, then checked for equality with
> other labels."  I believe that in the switch statement, "switch (x)",
> the type of the controlling expression is the type of x, possibly an
> "unsigned char" or a enumaral type.

The C89 language is different, though.  "The integral promotions are
performed on the controlling expression.  The constant expression
in each case label is converted to the promoted type of the controlling
expression."  So this change needs to be conditional.



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