Nelson.Weiderman@A.SEI.CMU.EDU (04/17/86)
We have recently had the same difficulty reading enumerated data types and we also initially thought it was a problem with our compiler (John Goodenough please take note). The answer to the riddle appears in ARM paragraph 14.3.5(5). As long as the user enters characters which are valid in an enumeration literal, there are no problems (this seems to be the unstated assumption in both Booch and the ARM examples cited). If the user enters an invalid character such as a "." or ";" then the last sentence of the cited paragraph comes into effect -- "The character or line terminator that causes input to cease remains available for subsequent input." Hence the infinite loop. Thus the examples are not as robust as they first appear, but the compilers are acting correctly.