home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / ada / 3916 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.8 KB  |  49 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!usc!wupost!darwin.sura.net!Sirius.dfn.de!news.belwue.de!news.uni-stuttgart.de!ucaa2385
  3. From: ucaa2385@iris3.csv.ica.uni-stuttgart.de (Peter Hermann)
  4. Subject: Re: Enum's start at 0?
  5. Message-ID: <1993Jan7.132548.1903@news.uni-stuttgart.de>
  6. Sender: news@news.uni-stuttgart.de (USENET News System)
  7. Organization: ica2
  8. References: <1992Dec30.033842.10112@seas.gwu.edu> <1993Jan5.220007.26218@gvl.unisys.com> <1993Jan6.025929.18871@seas.gwu.edu>
  9. Date: Thu, 7 Jan 1993 13:25:48 GMT
  10. Lines: 37
  11.  
  12. In article <1993Jan6.025929.18871@seas.gwu.edu> mfeldman@seas.gwu.edu (Michael Feldman) writes:
  13. >In article <1993Jan5.220007.26218@gvl.unisys.com> schrey@prc.unisys.com writes:
  14. >>In article <1992Dec30.033842.10112@seas.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes:
  15. >
  16. >[stuff deleted]
  17. >
  18. >>|> >
  19. >>|> Just like everything else in computing. ASCII characters, for example,
  20. >>|> run from 0 to 127, not 128. You can represent 0..127 using one less bit than
  21. >>|> 1..128.
  22. >>|> 
  23. >>   All right... then why do string indices start at 1? :-)
  24. >>
  25. >Beats me. Anyone out there have an authoritative answer?
  26. >
  27. >Mike Feldman
  28.  
  29. shouldn't beat you. Both are reasonable.
  30.  
  31. The first is considered and used more as an "offset".
  32. Additionally it coincides well with age-old integer-to-byte
  33. and vice versa representation.
  34. This representation can well be adopted and is the most likely
  35. fitting data format when talking to foreign hardware
  36. (in the serendipiduous sense). Additionally, the compiler has 
  37. the minimum conceivable work.
  38. I see no harm with that rule. I see the benefits.
  39.  
  40. The second is naturally used for indexing,
  41. which would be extremely disadvantages with a 0 as first index,
  42. when working on vector and matrix material,
  43. especially for more-dimensional matrices.
  44. Here, you do not think in offsets but in elements, e11,e12,e13,...
  45.  
  46. Peter Hermann
  47.  
  48.  
  49.