Path: utzoo!mnetor!uunet!ncc!alberta!att-ih!ihnp4!ihlpf!nevin1 From: nevin1@ihlpf.ATT.COM (00704a-Liber) Newsgroups: comp.lang.c Subject: Re: Of Standards and Inventions: A Cautionary Tale Message-ID: <4318@ihlpf.ATT.COM> Date: 7 Apr 88 18:37:02 GMT References: <10949@mimsy.UUCP> Reply-To: nevin1@ihlpf.UUCP (00704a-Liber,N.J.) Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 34 In article <10949@mimsy.UUCP> chris@mimsy.umd.edu (Chris Torek) writes: |[...] But lo! what has happened when we combine them all? |The answer to that lies in the following question: | | On a machine with 32 bit |long|s and two's complement | arithmetic, what is the type of -2147483648 in the preprocessor? | |Since the preprocessor is required to follow the same rules as the |compiler, and is possesed of the notion of unsigned, we find that it is |first to compute 2147483648 and then to negate it, and when it does the |former it finds that the type is |unsigned long|. The negation changes |nothing: /neither the type nor the value/. As noted earlier, the only |way to remove the unsigned attribute is to use a cast. But since the |preprocessor explicitly disallows casts, there is no way to get |-2147483648! What about doing something like (-2147483647 - 1)?? (Yes, I will admit it looks kludgy and I don't particularly like it, but it should work.) |The moral, if you will, of this story is that even obvious and |well-behaved inventions may not always work together. And even the obvious deficiencies due to new inventions have workarounds! :-) :-) Seriously though, I do agree that any changes made have to be thought out very, very carefully. -- _ __ NEVIN J. LIBER ..!ihnp4!ihlpf!nevin1 (312) 510-6194 ' ) ) "The secret compartment of my ring I fill / / _ , __o ____ with an Underdog super-energy pill." / (_