<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">This does not make sense:<div><br></div><div>Here is the compiler's definition of the builtin CARDINAL type:</div><div><br></div><div><div>MODULE Card;</div><div><br></div><div>IMPORT SubrangeType, Target, TInt, Tipe, Int;</div><div><br></div><div>PROCEDURE Initialize () =</div><div>  BEGIN</div><div>    T := SubrangeType.New (TInt.Zero, Target.Integer.max, Int.T, TRUE);</div><div>    Tipe.Define ("CARDINAL", T, TRUE);</div><div>  END Initialize;</div><div><br></div><div>BEGIN</div><div>END Card.</div><div><br></div><div><br></div><div>Notice that it is a subrange type [0..LAST(INTEGER)].</div></div><div><br><div>
<span class="Apple-style-span" style="font-size: 12px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><font class="Apple-style-span" color="#0000FF"><font class="Apple-style-span" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; ">Antony Hosking</span></span></font></font><font class="Apple-style-span" face="Gill Sans"><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-converted-space"> </span>|<span class="Apple-converted-space"> </span></span></span><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-style-span" style="font-family: 'Gill Sans'; ">Associate Professor</span></span><span class="Apple-style-span" style="font-family: 'Gill Sans'; "><span class="Apple-style-span" style="font-family: 'Gill Sans'; "> | Computer Science | Purdue University</span></span></font></div><div><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; ">305 N. University Street | West Lafayette | IN 47907 | USA</span></font></div><div><font class="Apple-style-span" color="#0000FF" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; ">Office</span></span></font><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-style-span" style="font-family: GillSans-Light; "> +1 765 494 6001 |<span class="Apple-converted-space"> </span></span></span></font><font class="Apple-style-span" color="#0000FF" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: 'Gill Sans'; ">Mobile</span></span></font><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-converted-space"> </span>+1 765 427 5484</span></span></font></div><div><font class="Apple-style-span" face="GillSans-Light"><br class="khtml-block-placeholder"></font></div></span></span></span></span></span></span></span><br class="Apple-interchange-newline"></span></div></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On 16 Dec 2009, at 17:56, Rodney M. Bates wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Tony Hosking wrote:<br><blockquote type="cite">On 16 Dec 2009, at 15:48, Peter Eiserloh wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">  <br></blockquote><blockquote type="cite"><blockquote type="cite">Hi Gang,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">0 - CARDINALs are an integral type defined by the language<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">spec to be from 0 (zero) to MAXINT (not MAXCARD).  Recently,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">a change was made to CM3 to extend the language it recognizes<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">beyond the original language spec (SPWM3), now CM3 understands<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">a LONGINT.  <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Was there a corresponding LONGCARD defined?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">    <br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">No.  But you can write:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">[0L..LAST(LONGINT)]<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">just as<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">CARDINAL=[0..LAST(INTEGER)]<br></blockquote><blockquote type="cite">  <br></blockquote>Actually, the line above was once true, long long ago, when dinosaurs<br>roamed unfettered.  CARDINAL was changed to be "just like"<br>(but not equal to) [0..LAST(INTEGER)].  This would have been<br>maybe early 1990s. <br>It took me years to figure out what this actually meant, and more<br>years to figure out why, but I believe I now know.  CARDINAL is not an<br>equal type to [0..LAST(INTEGER)], but otherwise has all the same<br>properties.  This makes the two mutually assignable, which is close<br>enough to equal to not matter in most contexts.  The exact consequences<br>follow from other language rules. <br>The motivation is this:  [0..LAST(INTEGER)] on a 32-bit machine is not<br>equal to [0..LAST(INTEGER)] on a 64-bit machine (or any combination of<br>machines with different values of LAST(INTEGER)), because the numeric<br>value of LAST(INTEGER) is part of the expanded type.  The one place this<br>matters is if you use pickles to transfer data between machines of different<br>word sizes.  If the type is [0..LAST(INTEGER)], the type signature (a hash<br>of the complete, expanded type definition) is different on the two machines,<br>and values of or containing this type cannot be transferred.  Exact type<br>signature matches are used in pickles to find corresponding types when<br>reading. <br>But pickles handle different sized INTEGER values fine, expanding/shortening<br>as needed.  Being a leaf in a type definition, INTEGER is always the same<br>type on any machine.  So CARDINAL was changed to be its own unique<br>type too, so it would be possible also to transfer CARDINAL values in pickles<br>between different word sizes. <br>So, we really should have a LONGCARD, parallel to CARDINAL.<br><br>Note that this also affects network objects, which use pickles to transfer<br>values of the objects.<br><br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">  <br></blockquote><blockquote type="cite"><blockquote type="cite">Can is use all 64-bits, or is it restricted to 63, like<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">the CARDINAL is only 31-bits.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">    <br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">63 bits, since its underlying base type is LONGINT.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">  <br></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+--------------------------------------------------------+<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">| Peter P. Eiserloh                                      |<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">+--------------------------------------------------------+<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">    <br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">  <br></blockquote></div></blockquote></div><br></div></body></html>