ed@contex.UUCP (Edward Bagdonas) (12/05/89)
I am curious if any discussion or thought has been given to extending the "switch" statment in C++ to handle non constant expressions. If so could you please convey those results to me? If not, perhaps this is a potential topic for discussion. E. Bagdonas
jeenglis@nunki.usc.edu (Joe English) (12/05/89)
ed@contex.UUCP (Edward Bagdonas) writes: > I am curious if any discussion or thought has been given to > extending the "switch" statment in C++ to handle non constant > expressions. That got hashed out in comp.lang.c++ a while ago; I think the main reason for not allowing non-constant and non-integer (class) expressions in case labels is that it's impossible to verify at compile time that each of the cases will have distinct values. That would significantly change the semantics of switch(). (Changing the semantics of switch() has been discussed as well, but most of the alternate proposals so far would violate the tenets of structured programming.) --Joe English jeenglis@nunki.usc.edu