home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / modula3 / 1169 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.3 KB

  1. Path: sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!usc!howland.reston.ans.net!spool.mu.edu!hri.com!noc.near.net!ceylon!newshost!fn00
  2. From: fn00@gte.com (Farshad Nayeri)
  3. Newsgroups: comp.lang.modula3
  4. Subject: Re: What is the representation of Text?
  5. Message-ID: <FN00.93Jan27115929@tahoe.gte.com>
  6. Date: 27 Jan 93 16:59:29 GMT
  7. References: <1993Jan25.230239.45587@slate.mines.colorado.edu>
  8.     <FN00.93Jan26072103@tahoe.gte.com>
  9.     <MOSS.93Jan26224045@CRAFTY.cs.cmu.edu>
  10. Sender: news@ceylon.gte.com
  11. Organization: GTE Laboratories, Waltham, Massachusetts, USA
  12. Lines: 39
  13. In-reply-to: moss@cs.cmu.edu's message of 27 Jan 93 03:40:45 GMT
  14.  
  15.  
  16. In article <MOSS.93Jan26224045@CRAFTY.cs.cmu.edu> moss@cs.cmu.edu (Eliot Moss) writes:
  17.  
  18.    I believe that SRC uses C-like strings (probably even null
  19.    terminated), and I am sure that GNU Modula-3 will. However, we can
  20.    always go to something more sophisticated, such as the Modula-2+
  21.    implementation, which uses a tree of string fragments, which may
  22.    tend to reduce the allocation overhead and the cost of certain
  23.    operations.
  24.  
  25. Eliot's comment brought up some questions in my mind. I have always
  26. been assuming that Texts in Modula-3 are not null-terminated (you can
  27. certainly insert '\000' in the middle of a "TEXT" without a problem.
  28.  
  29. Looking at the libm3 source, I can see that "Text"s _are_
  30. null-terminated, but I can't find any part of the code that _uses_ the
  31. null-termination (instead, a combination of memcpy and NUMBER is used).
  32.  
  33. So, _why_ are "Text"s null-terminated?
  34.  
  35. I can think of two possiblities: 
  36.  
  37. a) it makes debugging easier in a c-oriented debugger.
  38. b) some of the lower layers of the code (like the compiler) uses this
  39.    assumption. These layers are hidden from the user, so the user
  40.    never needs to worry about the null characters.  [I assume that
  41.    libm3 code for "Text" is not really the code that the compiler
  42.    executes, and "Text"s are probably embedded in the compiler.]
  43.  
  44. Unfortunately I don't have the source release, so I can't examine the
  45. source for the compiler.
  46.  
  47. --farshad
  48. --
  49. Farshad Nayeri                Intelligent Database Systems
  50. fn00@gte.com                  Computer and Intelligent Systems Laboratory
  51. (617)466-2473                 GTE Laboratories, Waltham, MA
  52.  
  53.   "To see is to forget the name of the thing one sees." -- Paul Valery
  54.