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,f25e853f410d55da X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: Time to join the fold? Date: 1999/01/25 Message-ID: <78iq2m$br9$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 436784047 References: <78abg4$cnc$1@its.hooked.net> <78i8s4$hth$1@its.hooked.net> X-Http-Proxy: 1.0 x8.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Jan 25 22:09:33 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1999-01-25T00:00:00+00:00 List-Id: In article <78i8s4$hth$1@its.hooked.net>, "Mike Silva" wrote: > Now for another question. Some people have mentioned getting into the Ada > "mind-set". What are the main components of this mind-set? What, IOW, > should I pay special attention to in order to avoid simply writing "C in > Ada" (whatever that might mean). Thanks again for the help. For the most part, that's just something you'll have to work out. (Is there a support group for recovering C coders?) One good example that does spring to mind is string handling. C coders want to be able to assign a length 5 string into a length 12 string because strcpy would do that for them. So their first try tends to be: Str : String(1..12); begin Str := "hiho!"; Which won't work in Ada because the two arrays aren't the same size. Then they will try using a loop or slice to assign the 5 characters only. Then they try to print the twelve character string. This won't do what they want, because Ada strings aren't null terminated. Then they discover that they have to instantiate a generic routine to ouput a number as a string, and they are liable to get insanely frustrated. The problem is that the approach is all wrong. Ada developers tend to handle strings as literals or constants whenever possible. The '&' operator on strings makes this much easier to deal with. Scalar numbers can be converted to strings inline w/ "'image". In a severe jam a declare block can be used to get a localized constant string, or one of the ada.strings packages can be used. This is just one example of many. I guess the main point is that you have to think in terms of the tools at your disposal, not in terms of the tools you *don't* have. T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own