From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,54c513170bafd693 X-Google-Attributes: gid103376,public From: "Tarjei T. Jensen" Subject: Re: Desirability of C++ Date: 2000/05/03 Message-ID: <8eonat$sqj3@ftp.kvaerner.com>#1/1 X-Deja-AN: 618604620 Content-Transfer-Encoding: 7bit References: <390DEC7F.9429C82C@online.no><390E2A20.B647D0D6@maths.unine.ch> <8em8mb$evd$1@wanadoo.fr><390EEF24.BD36AA24@maths.unine.ch> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 Organization: Kv�rner Group IT Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-05-03T00:00:00+00:00 List-Id: Robert A Duff wrote >The designer of Ada.Strings.Unbounded (Ben Brosgol) considered doing it >as in the above-mentioned package. The reason not to do it that way is >documented in the AARM -- assignment statements don't work properly. >That is, if you assign a 5-character string (whose max length is 80) to >a string variable whose max is 120, you will get a Constraint_Error, >even though 5 characters fit nicely in 120. JPR points this out in the >documentation for his package, and he provides a procedure for copying >strings, which should be used instead of assignment. A more natural conclusion would be that there was a language problem. In order to fix it one would either have to make the compiler aware of strings, make it possible to tell the compiler about what controls the size of a variable sized object like a counted string or make it possible to override the assignment operator. It would be convenient to be able to tell the compiler how to access the character array in string types other than the ordinary ada string. It would save a lot of copying. And it should be quite safe since routines that use the ordinary string types cannot change the length of the string. >Apparently, Turbo Pascal actually makes assignment work, which is >obviously preferable to either of the above Ada alternatives. On the >other hand, there are lots of *other* things wrong with the Turbo Pascal >solution, which have been pointed out in this thread. I think it was the ucsd-pascal people who first got it right. >This thread sure is wandering! I mean, it's hard to see how one can >explain the popularity of C or C++ by the fact that Turbo Pascal has >better strings than Ada (in one respect). That was what was being >discussed, wasn't it? ;-) > >In fact, C-style strings are quite primitive, and quite painful to work >with, even compared to Ada 83 strings. C has only one string type. It works reasonably well. Probably the most important "feature" is that everything is by reference, so there is no problems with strings of different sizes, etc. Greetings,