Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hcradm.UUCP Path: utzoo!hcrvax!hcradm!mike From: mike@hcradm.UUCP (Mike Tilson) Newsgroups: net.lang.c Subject: Re: limitations of casts, pointer and function declarartions... Message-ID: <1359@hcradm.UUCP> Date: Mon, 29-Oct-84 10:32:17 EST Article-I.D.: hcradm.1359 Posted: Mon Oct 29 10:32:17 1984 Date-Received: Tue, 30-Oct-84 04:54:19 EST References: <120@harvard.ARPA> Distribution: net Organization: Human Computing Resources, Toronto Lines: 16 It was noted that C compilers do not accept the following: int x; char *y; (char *)x = y; I assume that what is wanted is to treat storage location "x" as a cell that holds a "char *". Declaring "x" to be a union type is the portable way to do this. If one does not wish to be portable, C already allows the type cast you want, but it's a bit more complicated: *( (char **) &x) = y; I checked this on the Vax System V.2 compiler. It likes it just fine, and generates the obvious single instruction move. Repeat: it isn't portable.