Re: Token is an int ?
"David Genest" <[email protected]> Sat, 17 Mar 2007 15:13:45 -0400
| Newsgroups | gmane.comp.documentation.synopsis |
|---|---|
| Message-ID | <[email protected]> |
On 3/17/07, Stefan Seefeld <[email protected]> wrote: > > As the comment above says, characters represent themselves, i.e. you can say: > > Token::Type token = 'a'; > > The conversion from character to int is implicit. However, there is no > standard conversion from char to enum, i.e. the above wouldn't be possible > if Token::Type was an enumeration type. > (If MSVC allows an implicit conversion from character types to an enum type, > it is wrong. (See section 4.7 of the spec.) > Yes, you are right, implicit conversion is not done by msvc, I was also suggesting a change to the related uses to an explicit cast: Token::Type token = Token::Type('a'); D.