Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!cornell!biar!trebor From: trebor@biar.UUCP (Robert J Woodhead) Newsgroups: comp.lang.c Subject: Re: When is a cast not a cast? Message-ID: <561@biar.UUCP> Date: 17 May 89 04:00:36 GMT References: <2747@buengc.BU.EDU> <10191@smoke.BRL.MIL> <406@skye.ed.ac.uk> Reply-To: trebor@biar.UUCP (Robert J Woodhead) Organization: Biar Games, Inc. Lines: 25 In article <406@skye.ed.ac.uk> richard@aiai.UUCP (Richard Tobin) writes: >>Addition of pointers is a meaningless operation. >Not always. (I'm not discussing whether it's legal in C, just whether it's >meaningless.) Unfortunately, all the examples you provide depend on the various pointers pointing into a particular data structure. What with pointers being modified inside of functions, etc, etc, it is very difficult for a compiler to determine that a particular pointer ``addition'' is safe or not. The bottom line is, meaningless or not, it is a stupid and dangerous programming practice that will come back to haunt you, and it removes semantic information from your program that a decent compiler could use to your advantage. Finally, anyone unfortunate enough to be inflicted with the task of maintaining your code will be seriously tempted to invoke a voodoo death curse upon you. Join the programmers arrayed against pointer addition. Just Say No to bugs. -- Robert J Woodhead, Biar Games, Inc. !uunet!biar!trebor | trebor@biar.UUCP "The lamb will lie down with the lion, but the lamb won't get much sleep." -- Woody Allen.