Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 beta 3/9/83; site desint.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!sdcrdcf!trwrb!desint!geoff From: geoff@desint.UUCP (Geoff Kuenning) Newsgroups: net.lang.c Subject: Re: limitations of casts, pointer and function declarartions... Message-ID: <193@desint.UUCP> Date: Fri, 2-Nov-84 22:58:27 EST Article-I.D.: desint.193 Posted: Fri Nov 2 22:58:27 1984 Date-Received: Mon, 5-Nov-84 09:55:13 EST References: <120@harvard.ARPA> <6126@mcvax.UUCP> Organization: his home computer, Thousand Oaks, CA Lines: 29 In article <6126@mcvax.UUCP> guido@mcvax.UUCP (Guido van Rossum) writes: >> int x; >> char *y; >>/*### [cc] illegal lhs of assignment operator = %%%*/ >> (char *)x = y; > >Sorry, you're thinking Algol-68. What you need is: > *( (char*) &x ) = y; > I don't think that's the code that was intended. The guy wanted to do the same as x = (int) y; but wanted to put the typecast on the left instead of the right for readability reasons. Guido's code gives us the equivalent of this Vax code: x &= ~0xFF; x |= (int) y & 0xFF; and other code on other machines, depending on word size and byte ordering. -- Geoff Kuenning First Systems Corporation ...!ihnp4!trwrb!desint!geoff