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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38c827f7e800d317 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-06 13:04:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!cs.tu-berlin.de!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: conversion Date: Sun, 6 Jul 2003 20:04:13 +0000 (UTC) Organization: GMUGHDU Message-ID: References: <3EFCC18B.4040904@attbi.com> NNTP-Posting-Host: d2-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1057521853 16851 134.91.1.15 (6 Jul 2003 20:04:13 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Sun, 6 Jul 2003 20:04:13 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/831)) Xref: archiver1.google.com comp.lang.ada:40090 Date: 2003-07-06T20:04:13+00:00 List-Id: Alexander Kopilovitch wrote: : Georg Bauhaus wrote: : :> > The varying strings of unspecified maximum size are common for many applications :> > outside of current, quite restricted Ada world. And arrays of such strings :> > are no less common. :> :>Care to list some examples? : : /* C/C++ example */ : : char *Titles[] = { : "Quizionary", : "Nose To Nose", : "Myself", : "General Dissent", : "Veteran's Opinion", : "Corporate Science Weekly", : "Truth, Wealth, Health", : "Bribery Times" : }; If you need to have syntactic sugar, you can have Titles: constant array(1..8) of String_Access := (-"Quizionary", -"Nose To Nose", -"Myself", -"General Dissent", -"Veteran's Opinion", -"Corporate Science Weekly", -"Truth, Wealth, Health", -"Bribery Times"); where function "-"(s: String) return String_Access; I am always trying something like the following. The string literals end up as literals in the assembly listing, so there does not seem to be allocation at run time, despite new: procedure str is type String_Access is access constant String; Titles: constant array(1..8) of String_Access := (new String'("Quizionary"), new String'("Nose To Nose"), new String'("Myself"), new String'("General Dissent"), new String'("Veteran's Opinion"), new String'("Corporate Science Weekly"), new String'("Truth, Wealth, Health"), new String'("Bribery Times")); begin null; end str; But, as a sidenote, I alway try to avoid string literals in source code. They make the text fixed, a typo requires recompilation, language translation requires that programmers be involved, because the translators do not know how to recompile the program to include the latest translations, etc. If that seems too much, there could be an enumeration of the 8 strings above, such that, for every natural language (or other variation in the string values), you could have array(Languages, Kinds_of_Titles) of String_Access := ...; in some library package. What is more, the varying size you have mentioned is known at compile time in your example. But for sure string literals are not the usual input to a string processing program? -- Georg