home *** CD-ROM | disk | FTP | other *** search
- 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
- From: fn00@gte.com (Farshad Nayeri)
- Newsgroups: comp.lang.modula3
- Subject: Re: What is the representation of Text?
- Message-ID: <FN00.93Jan27115929@tahoe.gte.com>
- Date: 27 Jan 93 16:59:29 GMT
- References: <1993Jan25.230239.45587@slate.mines.colorado.edu>
- <FN00.93Jan26072103@tahoe.gte.com>
- <MOSS.93Jan26224045@CRAFTY.cs.cmu.edu>
- Sender: news@ceylon.gte.com
- Organization: GTE Laboratories, Waltham, Massachusetts, USA
- Lines: 39
- In-reply-to: moss@cs.cmu.edu's message of 27 Jan 93 03:40:45 GMT
-
-
- In article <MOSS.93Jan26224045@CRAFTY.cs.cmu.edu> moss@cs.cmu.edu (Eliot Moss) writes:
-
- I believe that SRC uses C-like strings (probably even null
- terminated), and I am sure that GNU Modula-3 will. However, we can
- always go to something more sophisticated, such as the Modula-2+
- implementation, which uses a tree of string fragments, which may
- tend to reduce the allocation overhead and the cost of certain
- operations.
-
- Eliot's comment brought up some questions in my mind. I have always
- been assuming that Texts in Modula-3 are not null-terminated (you can
- certainly insert '\000' in the middle of a "TEXT" without a problem.
-
- Looking at the libm3 source, I can see that "Text"s _are_
- null-terminated, but I can't find any part of the code that _uses_ the
- null-termination (instead, a combination of memcpy and NUMBER is used).
-
- So, _why_ are "Text"s null-terminated?
-
- I can think of two possiblities:
-
- a) it makes debugging easier in a c-oriented debugger.
- b) some of the lower layers of the code (like the compiler) uses this
- assumption. These layers are hidden from the user, so the user
- never needs to worry about the null characters. [I assume that
- libm3 code for "Text" is not really the code that the compiler
- executes, and "Text"s are probably embedded in the compiler.]
-
- Unfortunately I don't have the source release, so I can't examine the
- source for the compiler.
-
- --farshad
- --
- Farshad Nayeri Intelligent Database Systems
- fn00@gte.com Computer and Intelligent Systems Laboratory
- (617)466-2473 GTE Laboratories, Waltham, MA
-
- "To see is to forget the name of the thing one sees." -- Paul Valery
-