am@cam-cl.UUCP (08/10/87)
In article <1547@watcgl.waterloo.edu> kdmoen@watcgl.waterloo.edu (Doug Moen) writes: >This isn't pretty, but it solves your problem (of '\r' == '\n') > switch ( getchar() ) > { > ...... > case '\n': >#if '\r' != '\n' > case '\r': >#endif > common code for the "enter" morpheme > ...... > } Yes, it does look right doesn't it? BUT, the dpANS document would make this illegal (or rather non-strictly conforming) in that an implementation is quite at liberty to use different character codes in the pre-processor than in the compiler. (See footnote in the OCt 86 public review draft). [Yes, I think this is crazy too, I suppose the committee are endorsing "existing practice". It allows compiler vendors to supply one pre-processor regardless of whether the 'compiler proper' is being used as a cross-(character-set)compiler. Of course, the pre-processor and compiler *should* use the same tables. Send in your complaints about this to ANSI before it is too late!] I do not remember ANSI requiring '\n' != '\r' either although they probably do.