Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!rutgers!ames!ptsfa!hoptoad!academ!uhnix1!nuchat!steve From: steve@nuchat.UUCP (Steve Nuchia) Newsgroups: comp.lang.c Subject: Re: Distinguished pointers (was Re: Weird syscall returns) Message-ID: <274@nuchat.UUCP> Date: Fri, 31-Jul-87 19:41:52 EDT Article-I.D.: nuchat.274 Posted: Fri Jul 31 19:41:52 1987 Date-Received: Thu, 6-Aug-87 07:16:09 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <6129@brl-smoke.ARPA> Organization: Public Access - Houston, Tx Lines: 36 Summary: distinguished values and switch In article <6129@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes: > symbolic names such as SIG_ERR is helpful, since that permits all > implementations to provide a meaningful definition. However, my specific This reminds me of an issue regarding symbolic constants and the switch construct that has come up a handful of times porting stuff. For example, lets say we are switching on an input character, we wrote the code for UNIX, and we are porint it to OS9. switch ( getchar() ) { ...... case '\n': case '\r': common code for the "enter" morpheme ...... } Now we find ourselves on OS9, where the compiler says that '\n' and '\r' are both 13. (They thoughtfully provide '\l' == 11). Now the switch doesn't work, even though all it needs is to be collapsed. This same situation arrises in porting from a featureful unix (say bsd) to a feature-sparse environment, say a 3b2. It happens, perhaps not "often", but it happens, that error indicators and the like wind up with aliased names and a similar switch syntax error come up. To "fix" the problem we have to make the code not reverse portable - we have to break it to get it to work. I'm not sure I want to require the compiler to recognise and allow (warning?) the special case of stacked identical case values, put it might be worth looking into. More random thoughts for your consideration, Steve Nuchia {{soma,academ}!uhnix1,sun!housun}!nuchat!steve