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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,45b47ecb995e7a3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-13 07:33:43 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!psinet-eu-nl!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Ada Idioms Progress Preview Date: Mon, 13 Aug 2001 10:19:54 -0400 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <9l8nmc$89m$1@nh.pace.co.uk> References: <3B6F1B2F.4FC3C833@gsde.hou.us.ray.com> <5ee5b646.0108071819.6e84e33d@posting.google.com> <3_Xc7.45$NM5.84779@news.pacbell.net> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 997712396 8502 136.170.200.133 (13 Aug 2001 14:19:56 GMT) X-Complaints-To: newsmaster@news.cam.pace.co.uk NNTP-Posting-Date: 13 Aug 2001 14:19:56 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:11850 Date: 2001-08-13T14:19:56+00:00 List-Id: I'd have to agree. Maybe we ought to have something in the AdaPower FAQ on this. My experience has indicated that the most frequently messed up things by C/C++ programmers using Ada are: 1) Improper handling of strings because of dissimilar language models & trying to force Ada strings to look like C strings. 2) Improper passing of parameters because of C's historic lack of pass-by-reference & all the history that goes with this. 3) Pointers to every blankety-blank thing on the whole blankety-blank planet because in C/C++ you have to do it this way. 4) Improper use of 'Address - usually related to some version of #3 above. But, then again, I still think the three most frequently sung songs are "Happy Birthday To You", "Auld Lang Syne" and "Inna Godda Davida" :-) MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/ "Ted Dennison" wrote in message news:E8Rd7.282$D4.307@www.newsranger.com... > In article <3_Xc7.45$NM5.84779@news.pacbell.net>, Jay Nabonne says... > > > >useful for me - and it's what I thought of when I saw the word idiom - is > >something that says "in order to do , given that there's more than one > >way to do it within the Ada language, here's how you write code that looks > >like an Ada programmer wrote it and doesn't look like a > >C++-programmer-writing-Ada wrote it.". > > > >I'm interested in how to "think in Ada"... > > The best advice I can give you today is to go to the Ada Source Code Treasury at > http://www.adapower.com/adacode.html . The master site itself is useful too. > > Based on my experience with native C speakers, here are some basic things to get > you started: > > o Strings in Ada are *very* different from Strings in C. Ada strings end at the > end of the array (or slice of it you specify), not at some arbitrarily-chosen > "terminator" character. Look into the "&" operator for arrays, and the array > attributes 'length, 'first, and 'last. 'image is damn nice too. Don't be > discouraged if you have trouble with this seemingly simple thing. Conceptually, > this is probably the biggest difference the languages have. > > o The techniques you learn for dealing with strings can be used for *all* > arrays. > > o Make yourself familiar with the language defined attributes ( > http://www.ada-auth.org/~acats/arm-html/RM-K.html ). > > o Passing a large data structure as a parameter does *not* mean that the whole > thing gets copied. The compiler will internally pass a reference to the > structure if that would be more efficient. Do *not* use pointers yourself to > force this effect. > > o You almost never need pointers. > > o If you think you need a pointer, see the previous point. :-) > > --- > T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html > home email - mailto:dennison@telepath.com