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,1cf653444208df72 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-10 20:00:50 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!dca6-feed2.news.digex.net!intermedia!newsfeed1.cidera.com!Cidera!cyclone1.gnilink.net!wn3feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3BC50B78.DDCB07FF@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ada vs. cpp References: <9pgr68$7pu1@news.cis.okstate.edu> <3bbd6287.346843109@news.cis.dfn.de> <9pkco7$9qe1@news.cis.okstate.edu> <3bc15a16.1317281@news.cis.dfn.de> <9ps9uu$a2g1@news.cis.okstate.edu> <3BC2FD54.69BA446D@sparc01.ftw.rsc.raytheon.com> <9pv54d$9aa1@news.cis.okstate.edu> <3bc40a3f.4768875@news.cis.dfn.de> <9q1ker$aik1@news.cis.okstate.edu> <9q2ki6$9281@news.cis.okstate.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 11 Oct 2001 03:00:50 GMT NNTP-Posting-Host: 12.86.38.189 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1002769250 12.86.38.189 (Thu, 11 Oct 2001 03:00:50 GMT) NNTP-Posting-Date: Thu, 11 Oct 2001 03:00:50 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:14213 Date: 2001-10-11T03:00:50+00:00 List-Id: David Starner wrote: > > On 10 Oct 2001 19:53:11 +0200, Pascal Obry wrote: > > With this definition every language support string. > > Pretty much. Algol 60 doesn't support them. It's one of the fundamental > data types; any programming language that didn't support them would be > seriously deficent. > > > I'm sorry to insist but "char *" is a pointer not a > > string. > > A pointer to *what*? The real problem is that a "char *" is simply a pointer to **A** character. It may be used as a pointer to the first of a set of contiguous characters but you can never tell from its definition. Not all "char *" actually equate to a string. If you want to call a C function and pass a single character out as a parameter, that parameter must be defined as a "char *". If you want to deal with a contiguous set of characters, you also define the parameter as a "char *". A "char *" at best holds the address of a single character. It may be a null pointer, in which case it points to nothing useful. C has a similar problem with all arrays. The name of the array is merely a constant pointer to the first element of the array. No other information about the array is available, such as the upper bounds, or the end of useful data in the array. Function parameters for int arrays are passed as "int *". If you want to return a single int from an array, through the parameter list, you must pass it as "int *". C's basic problem is not really strings. Its fundamental problem is that arrays are not a first class type. Jim Rogers Colorado Springs, Colorado USA