Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: What's Wrong here? Message-ID: <6785@brl-smoke.ARPA> Date: Fri, 4-Dec-87 12:02:54 EST Article-I.D.: brl-smok.6785 Posted: Fri Dec 4 12:02:54 1987 Date-Received: Wed, 9-Dec-87 03:49:24 EST References: <278@westmark.UUCP> <6755@brl-smoke.ARPA> <6855@sunybcs.UUCP> <6949@sunybcs.UUCP> <1958@frog.UUCP> <6996@sunybcs.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 42 Xref: mnetor comp.lang.c:5733 comp.sys.ibm.pc:10808 In article <6996@sunybcs.UUCP> ugfailau@joey.UUCP (Fai Lau) writes: >I was very angry with Doug's name-calling post... Perhaps you should try harder to understand things before reacting to them. If it was the epithet "brain-damaged" that you objected to, be advised that it was directed at the architecture you described (where sign bits stuck in the "on" state on a left shift). This is standard terminology for architectural design defects. A later poster has advised that the 80*86 architecture does not behave the way you described it. You can find out by running the following test on your toy computer; I don't have convenient access to one or I would have tried it myself: #include main() { register short i; /* make sure it's 16 bits */ register int j; for (i = 0x5555, j = 0; j < 16; ++j) { i <<= 1; if (j % 2 && i & 0x8000) { printf("Fai Lau was right!\n"); return 0; } } printf("Gobble, gobble!\n"); return 1; } >Personally I don't like doing things by the books. The approach you said you take to the use of programming languages will get you into great trouble when you have to port megalines of source code to dozens of disparate environments. Those of us who have done this over the past couple of decades have learned how to avoid, or at least harness, machine dependencies in our code. We most certainly DO discourage exploiting machine dependencies under most circumstances, and C signed right-shift sign propagation (or lack of it) is one of the things you should avoid relying on. Try taking advantage of other people's experience so you don't have to learn everything the hard way.