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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newsfeed.vmunix.org!feed.news.tiscali.de!news.belwue.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <1111607633.301232.62490@z14g2000cwz.googlegroups.com> <4793664.vi5Yol0h1t@linux1.krischik.com> Date: Thu, 24 Mar 2005 16:34:06 +0100 Message-ID: <14gsuwfhgs0ai$.12mwgmgpros8t$.dlg@40tude.net> NNTP-Posting-Date: 24 Mar 2005 16:34:02 MET NNTP-Posting-Host: 6ddd32e7.newsread2.arcor-online.net X-Trace: DXC==bNLOWVQj7Tadj;CH1=J1PQ5U85hF6f;TjW\KbG]kaMX]kI_X=5KeaVEUSL=4Tg>k^[6LHn;2LCV^COgUkn_?_Y_[NIWR>=fLjR X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:9916 Date: 2005-03-24T16:34:02+01:00 List-Id: On Thu, 24 Mar 2005 14:16:49 +0100, Martin Krischik wrote: > Jerry Coffin wrote: > >> Speaking of strings, I'll digress for a moment: personally, I find it a >> bit humorous when Ada advocates talk about things like having five >> string types as an advantage. IMO, the need, or even belief, that five >> string types are necessary or even useful is a _strong_ indication that >> all five are wrong. > > Actualy there are only 3 of them. And they are usefull - two examples: How so? 1. String 2. Wide_String 3. Unbounded_String 4. Wide_Unbounded_String 5. xN bounded character string, each instantiation separate 6. xM bounded wide character string, each instantiation separate In fact, it is far more than 5, it is close to infinite number of them. OK taking a 64-bit machine N is about 2**64! (:-)) > I have worked a lot with SQL and I allways wound it cumbersome to map the > SQL string type to C++. Most SQL string types are bounded - they have a > maximum size. std::string (and IBM's IString) is unbounded - so before you > can store your string inside the database you have to make a sanity check. > In Ada I could use Ada.Strings.Bounded_Strings instead. > > The other example is CORBA. CORBA has two string types: string and > sting. In C++ both a mapped to std::string - and the CORBA/C++ > mapping must check the size of the sting. In Ada they are mapped to > Ada.Strings.Unbounded_Strings and Ada.Strings.Bounded_Strings. Clearly, in Ada spirit should rather be constraining and cloning an existing type: type My_Interface_String is new Other_String (); To be honest, there is no any advantage in having n-independent string types, especially when some of them are arrays and some are not. All string types should to be related and that includes not only the allocation strategy dimension: fixed - bounded - variable (+ user-pool allocated + task-safe + etc), but also the encoding one: Latin-1 - UCS-2 (+ EBCDIC + UTF-8 + UTF-n + whatsoever would come at us.) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de