Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!sundc!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: comp.lang.c Subject: Re: Incrementing after a cast Message-ID: <405@hadron.UUCP> Date: Fri, 2-Jan-87 07:13:19 EST Article-I.D.: hadron.405 Posted: Fri Jan 2 07:13:19 1987 Date-Received: Fri, 2-Jan-87 20:36:32 EST References: <2029@brl-adm.ARPA> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 30 Summary: groan In article <2029@brl-adm.ARPA> .csnet"@relay.cs.net> writes: (Something confused, including:) > "Think of the bits refered to as p as a (sometype *). > If don't have enough bits or you have too many bits > do something reasonable. Now increment the (sometype *) > you're thinking of. Now put the results back into p. > If you don't have enough bits or you have too many bits, > do something reasonable." Others have already commented on special-casing, models of computation, and the like, and I couldn't do it better. Let me pick at this a moment. First, "increment": what's the sizeof(bits)? By how much does one increment? Second: "something reasonable": I w i l l pick at this, despite your request. There is a good model (modulo arithmetic) for what to do if different integers are different sizes. What model do you propose for pointers? For s t r u c t u r e s ? C gives warnings on some casts, anyway; now you want to make this even worse? Third: what is wrong with (*sigh*): type1 p; p = (type1) ((type2)p + 1); If anyone replies with "too many keystrokes" I am not responsible for the responses he or she gets. From anyone. Self included. -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP} jsdy@hadron.COM (not yet domainised)