Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!killer!texbell!sugar!ficc!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond From: diamond@csl.sony.JUNET (Norman Diamond) Newsgroups: comp.lang.c Subject: Re: A cast pointer is NOT an lvalue!? (ANSI C) Keywords: X3J11, pointers, cast, lvalue Message-ID: <10034@socslgw.csl.sony.JUNET> Date: 11 Oct 88 23:35:39 GMT References: <479@midgard.mn.org> Organization: Sony Computer Science Laboratory Inc., Tokyo, Japan Lines: 25 In article <479@midgard.mn.org>, dal@midgard.mn.org (Dale Schumacher) writes: > I used a pointer cast construct like this: > > value = *((long *) argp)++; Since you wanted a post-increment, it is trivial to do it properly: value = *((long *) argp++); If you wanted to increment argp by the length of a (long *), then you have to do: value = *(long *) argp; argp += (sizeof (long *)) / (sizeof argp); which cannot give a correct result if sizeof (long *) is not a multiple of sizeof (int *). However, despite all the discussions I've seen about various brain-damaged machines, none had *these* two sizes unequal. Anyway, it will work whenever your attempted original version would work. -- ------------------------------------------------------------------------------- The above opinions are my own. | Norman Diamond If they're also your opinions, | Sony Computer Science Laboratory, Inc. you're infringing my copyright. | diamond%csl.sony.jp@relay.cs.net