This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH]: Don't apply default conversions to C switch expressions
- From: Dale Johannesen <dalej at apple dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Dale Johannesen <dalej at apple dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 Dec 2001 17:27:18 -0800
- Subject: 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 184.108.40.206 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.