Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!think!harvard!seismo!umcp-cs!aplcen!osiris!phil From: phil@osiris.UUCP (Philip Kos) Newsgroups: net.lang.c,net.micro.pc,net.unix Subject: Re: C'mon, guys! Message-ID: <835@osiris.UUCP> Date: Thu, 19-Jun-86 09:15:36 EDT Article-I.D.: osiris.835 Posted: Thu Jun 19 09:15:36 1986 Date-Received: Sat, 21-Jun-86 12:56:12 EDT References: <811@bu-cs.UUCP> Organization: Johns Hopkins Hospital Lines: 64 Xref: watmath net.lang.c:9511 net.micro.pc:8764 net.unix:8288 Barry Shein writes: > Guy Harris writes: > >...sometimes I think pointers should be *subtracted* from C, since people > >seem to get very confused about them... > >...OK, maybe they're useful, and shouldn't be removed. C classes should > >spend *lots* more time on them than they are doing, though, given these > >problems; better that people learn in class before they start writing code > > Being as I teach a couple of C courses a year here at BU I thought I > would comment on this, perhaps it would be of some use to language > designers (or make them give up entirely!) > > It's not 'C', I've had the same basic problems with students when > teaching IBM assembler, PL/I and Pascal. > > There seems to be some fundamental problem with distinguishing > "the thing" from "the thing contained"*..... > > -Barry Shein, Boston University I'm sure that this is the problem with with many programmers, but not all. I just ran into a situation yesterday here at the Hospital where one of our programmers was falsely attributing a bug to the C compiler because the following declaration caused the program to die of a segmentation violation: static char **ptrarray = { "", "str1", "str2", "etc." }; The programmer found that the alternate declaration static char *ptrarray[] = { "", "etc." }; ran just fine. The confusion was compounded by the fact that this programmer was taught in a supposedly reputable C class that *the two declarations were always identical*. I explained the situation in which the two are effectively identical (formal parameter to a function, natch) and the reason why the first just wouldn't work the way it was intended, and things are OK now, but I'd like to point out here that it's not just student C programmers who get confused about pointers, and much more care needs to be taken on both ends of the learning exchange process to ensure that the concept is transferred completely and correctly. (Of course there really *is* a bug in the compiler, since it let the original declaration through without even a peep; it's just not the bug imagined by the programmer. For everyone's info, the compiler is cc on OSx v3.1 [Pyramid Computer Corp.] and I have suggested that the company be notified of this bug. In the meantime, can anyone tell me whether this is a known pcc bug, or is it specific to Pyramid's cc?) Phil Kos ...!decvax!decuac The Johns Hopkins Hospital > !aplcen!osiris!phil Baltimore, MD ...!allegra!umcp-cs "People say I'm crazy, dreaming my life away..." - J. Lennon