Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: increment casted void pointer -- ANSI? Message-ID: <1991Mar12.173430.11976@zoo.toronto.edu> Date: Tue, 12 Mar 1991 17:34:30 GMT References: <4142@rwthinf.UUCP> <1991Mar8.165300.11692@zoo.toronto.edu> <166@tdatirv.UUCP> Organization: U of Toronto Zoology In article <166@tdatirv.UUCP> sarima@tdatirv.UUCP (Stanley Friesen) writes: >>There is no way to say "pretend this variable has a different type" in C. > >To pretend a variable has a different type utter the following magic >incantations: > >b = *++ *(char **)&p; Not quite. This says "pretend that a sequence of bits, starting at the start of `p', has a different type". Whether this does the job depends on whether you take "pretend" to mean "convert it and then convert it back" or "just view the bits differently". Consistency with casts would imply the former, especially since all bets are off if you do the latter. The original inquirer clearly wanted the former. -- "But this *is* the simplified version | Henry Spencer @ U of Toronto Zoology for the general public." -S. Harris | henry@zoo.toronto.edu utzoo!henry