home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!gatech!rpi!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.c
- Subject: Re: Most difficult part of learning C?
- Date: 26 Aug 1992 15:58:13 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 27
- Message-ID: <17g9mlINNsu1@early-bird.think.com>
- References: <1992Aug25.180919.10370@samba.oit.unc.edu> <behrenss.714775792@hphalle6> <chuckb.714781695@milton>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <chuckb.714781695@milton> chuckb@milton.u.washington.edu (Chuck Bass) writes:
- >I would bet that assembly language programmers have no problem
- >picking up C's notion of pointers.
-
- I disagree. Assembly programmers are used to pointers being addresses, and
- arithmetic on pointers being address arithmetic. They're probably the ones
- who get most confused by C's automatic scaling during ptr+integer
- calculations, and don't understand why p+=sizeof(*p) doesn't do what they
- expect.
-
- On the other hand, perhaps your comment was motivated by the fact that most
- other high level languages don't provide pointer arithmetic at all.
- Programmers used to PL/O, Pascal, or Ada are familiar with pointers being
- used for things like linked lists, but not pointers into the middle of
- objects. Assembly programmers can deal with pointers that can address
- anything.
-
- I never had this problem because my introduction to pointers was in PL/I on
- Multics, which has extensions that perform pointer arithmetic (but since
- PL/I doesn't have typed pointers, the arithmetic is on the raw address,
- rather than being scaled automatically as in C).
-
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-