Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!cornell!batcomputer!garry From: garry@batcomputer.tn.cornell.edu (Garry Wiegand) Newsgroups: comp.lang.c Subject: Re: incrementing after a cast Message-ID: <1706@batcomputer.tn.cornell.edu> Date: Thu, 4-Dec-86 18:15:58 EST Article-I.D.: batcompu.1706 Posted: Thu Dec 4 18:15:58 1986 Date-Received: Fri, 5-Dec-86 06:19:00 EST Reply-To: garry%cadif-oak@cu-arpa.cs.cornell.edu Organization: Cornell Engineering && Flying Moose Graphics Lines: 36 In a recent article kanner@apple.UUCP (Herbert Kanner) wrote: >... > L = *((sometype *) chp)++; >... >Our problem arises with the allegation that K&R makes this construct >illegal... This was some discussion on the net a few months about whether this ought to be legitimate. The context I would use it in is trying to recycle "valuable" register variables to point to different things during the life of a routine. For example, if I happen to know that A and B never overlap during execution, and that my machine only has 1 available-to-C register, I might want to do: ... register char *A; # define B ((float *)A) ... and expect both *A++ and *B++ to work and to be in registers for me. If I know that a pointer and an int take the same space and instructions on my machine I might also want to get away with: register char *A; # define B ((int)A) ... ... *A++; ... ... ... B = 27; Unfortunately, that's not the way things stand on any compiler I have access to - your compiler must be exceptionally forgiving. I think the new spec doesn't disturb the status quo. garry wiegand (garry%cadif-oak@cu-arpa.cs.cornell.edu)