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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7f5c70275787af8 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: Ada vs Delphi? Date: 1999/08/16 Message-ID: <7p96si$4uo$1@nnrp1.deja.com>#1/1 X-Deja-AN: 513367798 References: <37ab421a.5414989@news.total.net> <37ab8bd1.0@news.pacifier.com> <37ae1fc8.653954@news.clara.net> <7olfni$jsu$1@nnrp1.deja.com> <37b129ae.43419124@news.total.net> <7os3tj$bao$1@nnrp1.deja.com> <37b54687.54956646@news.total.net> X-Http-Proxy: 1.0 x31.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Mon Aug 16 14:23:27 1999 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I) Date: 1999-08-16T00:00:00+00:00 List-Id: In article <37b54687.54956646@news.total.net>, aratel@total.net (Andre Ratel) wrote: > Sorry, I should have mentioned this. In Delphi, a cardinal is defined > as an unsigned 32-bit with range 0 .. 4294967295 whereas an > integer is a signed 32-bit with range 2147483648 .. 2147483647. > So, yes, cardinal is a completely different type and it contains 0. ... > If I understand correctly, in Ada, some types have subtypes. So I > could declare > > N21: Integer; > n1, n2: Natural; > > and evaluate the expression > > N21:= n2 - n1; > > without problem. Exactly. The only hitch is that subtypes cannot have a greater range than their base type. So Natural'last = Integer'last. If you want to use that extra bit for a larger positive range, you'd have to go to a separate integer type (actually probably a modular type, but let's not get into that here). In that case you will have to perform the explicit conversions to get the assignment to work. And of course the conversion will raise an exception if the value won't fit in an integer. -- T.E.D. Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.