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,1042f393323e22da X-Google-Attributes: gid103376,public From: ka@socrates.hr.lucent.com (Kenneth Almquist) Subject: Re: Any research putting c above ada? Date: 1997/04/18 Message-ID: <5j8ukr$lu9@nntpa.cb.lucent.com>#1/1 X-Deja-AN: 235832309 References: <5ih6i9$oct$1@waldorf.csc.calpoly.edu> <5ijb0o$ajc@ns1.sw-eng.falls-church.va.us> <334d3da5.14386594@aplcen.apl.jhu.edu> <2senchydgk.fsf@hpodid2.eurocontrol.fr> <5im3an$3dv@bcrkh13.bnr.ca> <33526cbf.41c6@cca.rockwell.com> <5iusvd$118e@newssvr01-int.news.prodigy.com> <33530e22.5940@worldnet.att.net> <5j18h3$1564@newssvr01-int.news.prodigy.com> Organization: Lucent Technologies, Columbus, Ohio Newsgroups: comp.lang.ada Date: 1997-04-18T00:00:00+00:00 List-Id: NKSW39B@prodigy.com (Matthew Givens) wrote: > "James S. Rogers" wrote: >> Of course there are different types which use any integer-like >> representation. That does not make the types even approximately >> compatible. Incompatible types should not be masked by using one >> single integer representation for all of them. > > Of course not, and I don't. But judicious use of type mixing is fine. > My favorite example is converting to lower case: 'A' + 32. Simple and > easy, in C. Not a terribly convincing example, from my perspective. First, there is rarely reason to do this. C and Ada provide library routines for case conversion. Calling them is "simple and easy," and they handle the local character set, so that code which uses them is portable to the systems using different character sets. Second, the Ada equivalent to your example is not that complex: Character'val(Character'pos('A') + 32) This is more verbose because of the conversions, but the conversions provide a clue to anyone who has to port the code. If you are writing throw-away code, sticking in the conversions is no big deal. If the code you are writing is going to have to be maintained years from now (either by you or someone else) it is probably worth making the dependency on the character set a little more conspicuous than the C code does. Kenneth Almquist