home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 12869 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.6 KB  |  39 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!mcsun!sunic!kth.se!news.kth.se!RICHARD
  3. From: RICHARD@CLYDE.ttt.kth.se
  4. Subject: Re: Why should POINTERS be so damn hard to understand ?
  5. In-Reply-To: barmar@think.com's message of 27 Aug 1992 15:34:19 GMT
  6. Message-ID: <RICHARD.92Aug27193319@CLYDE.ttt.kth.se>
  7. Sender: usenet@kth.se (Usenet)
  8. Nntp-Posting-Host: clyde.ttt.kth.se
  9. Organization: Department of TeleTransmission Theory
  10. References: <l9nl34INNhln@almaak.usc.edu> <25233@castle.ed.ac.uk>
  11.     <1992Aug27.135946.6622@infonode.ingr.com>
  12.     <17islrINNh6c@early-bird.think.com>
  13. Date: Thu, 27 Aug 1992 18:33:19 GMT
  14. Lines: 23
  15.  
  16. In article <17islrINNh6c@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
  17.  
  18. This was an example of a tight loop with "untyped pointers":
  19.  
  20.    int a[1000];
  21.    char *_i;
  22.  
  23.    for (_i=(char *)a; _i<a+1000*sizeof(int); _i+=sizeof(int))
  24.        *(int *)_i = whatever();
  25.  
  26.    I would epect this to produce almost identical code.  And in a language
  27.    where pointers weren't typed, you wouldn't need all the casting.
  28.  
  29. Of course, and in C, as you HAVE typed pointers, you wouldn't need either
  30. type casts OR sizeof!
  31.  
  32. --
  33. !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
  34. ! Richard Levitte, System manager       ! tel: int+46-8-790 64 23           !
  35. ! Royal Institute of Technology         ! fax: int+46-8-791 76 54           !
  36. ! Department of Teletransmition Theory  ! Internet: richard@ttt.kth.se      !
  37. ! S-100 44 Stockholm, Sweden            !                                   !
  38. !---------------------------------------------------------------------------!
  39.