Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!uvaarpa!mcnc!rti!sheol!throopw From: throopw@sheol.UUCP (Wayne Throop) Newsgroups: comp.lang.c Subject: pointers is pointers (a cautionary tale) Summary: actually, they aren't... and therein lies many a story Message-ID: <0891@sheol.UUCP> Date: 28 Aug 90 23:00:16 GMT References: Lines: 35 > From: meissner@osf.org (Michael Meissner) > C programmers are notorious for thinking that all pointers look the > same. I had to put in several options > [..into the DG MV Eclipse C compiler..] to either flag when one type of > pointer was used in the wrong context, or silently add extra > instructions so that programmers who were too lazy to type things > correctly could get their programs to work. And even these heroic efforts would not save the proud, scarce, and noble band of siblings who were trying to port code to this class of machine from those C coders out there who were actively perverse in their faith in the pointerness of pointers. I recall one time when I had employed all the checks that Michael had implemented, and STILL pointers ended up in the wrong format with no warning. Eventually, it was discovered that this particular piece of cr... uh, code deliberately and with malice aforethought declared some pointer externals to be type (struct foo*) in some modules and (char *) in others. (I say we found this "eventually". Lint would have found it immediately, of course, but the original coders had done something-or-other to cloud lint's mind on the matter. Never did get that sucker running on the MV, as I recall, though it consumed many a CPU cycle on Vaxen the world over.) ( If I were to try porting it today, I'd probably take to calling the program "Bo". You know. "Bo knows pointer format." "Bo knows endianness." "Bo knows stack direction." "Bo knows the linker algorithm." "Bo knows int == long." And so on, ad nauseam. ) Like they say, what programers don't know ain't the problem. It's all them things they DO know that jest ain't SO. -- Wayne Throop !mcnc!rti!sheol!throopw or sheol!throopw@rti.rti.org