CompuServe Messages

switch()

    17-Dec-91 09:37:59
Sb: #17834-switch()
Fm: Greg Comeau@Comeau Cmptg 72331,3421
To: Steve Ahlstrom 76703,2006
(I see that Rob's code has been addressed, but to take a tangent to keep this conversation alive a bit more on part of the subject that's been brough up:) >'A' is a character constant…. I am surprised that your compiler didn't >complain about 'ee' The deal with character constant is somewhat confusing. The deal is that even though it is a *character* constant, it is of type *integer* in C (in C++ is is indeed a char) and hence there was no complaint. That is to say, sizeof('?') == sizeof(int). There are a few rarer cases where doing this is useful, however they are so uncommon that compilers should issue a warning (perhaps initiated by a compiler switch) if you code it.