<div dir="ltr"><div dir="ltr">>So to put the cat amongst the pigeons again :-)...</div><div dir="ltr"><br></div><div>Yes very well said.😇 And all the birds are long ago in the highest tree they could find.</div><div>And the cat sits licking itself in the sun: "It didn't happen anyway!"</div><div><br></div><div>So do I understand then that, to solve the multiple type size issue (which is basically a hardware issue)</div><div>you propose sub-ranges (which are an aid to software development)??</div><div><br></div><div>I would not like to teach that to a 14 year old, Dave. My oldest son did very well with the Wirth and Reiser book</div><div>at the time. It taught him reading and clear thinking. But this would have been a bridge too far </div><div>because the primary concepts are fudged</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 2, 2020 at 6:06 PM <<a href="mailto:dave@brownsmeet.com">dave@brownsmeet.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">While I agree on Oberon 2007+, this is not sufficient for original <br>
Oberon2 systems with SHORTINTs and (signed) BYTES. It's not an issue on <br>
Oberon2007+ because of the freer integer type compatibility rules.<br>
<br>
e.g. myshort := 0FFFFH<br>
<br>
doesn't work on multi-size oberon2 compilers because 65535 is bigger <br>
than MAX(SHORTINT) which is 32767.<br>
<br>
And using MOD to restrict the size doesn't work on such compilers <br>
because the size of the result of an arithmetic operation such as MOD <br>
that has a INTEGER parameters is INTEGER. There is no special case <br>
handling for MOD: the compiler doesn't look at the right hand argument, <br>
see if it is a constant, and work out how many bits that constant would <br>
require.<br>
<br>
(It could, but I don't know of any that do, and it's not covered in the <br>
language report, or in system specific documents that I have seen.)<br>
<br>
The more we discuss this the more I'm convinced that the compiler needs <br>
to be more sophisticated: rather than hex constants being rapidly <br>
treated as signed integers, they need a distinct intermediate <br>
representation that can be taken through the expression evaluation <br>
handling to the point where we can make a valid decision on whether they <br>
are an acceptable size.<br>
<br>
But - this is quite a lot of special case code for compilers that <br>
support multiple sizes of integer.<br>
<br>
And actually it is the support of multiple sizes of integer that is the <br>
real can of worms here, hex literal issues are just one issue.<br>
<br>
So to put the cat amongst the pigeons again :-), I have seen no better <br>
solution to multiple integer sizes than Wirth and Knudsen's original <br>
Pascal 6000 compiler (circa 1975) and its support for integer subranges.<br>
<br>
The BYTE/SHORTINT/INTEGER/LONGINT approach is for me the worst solution, <br>
it has neither the simplicity of a single INTEGER size, nor does it <br>
avoid the complexities of subranges, while at the same time introducing <br>
more special cases and limitations.<br>
<br>
Hey ho -- Dave.<br>
<br>
<br>
On 2020-05-02 16:12, Joerg wrote:<br>
> Dave<br>
> <br>
> For smaller values than the size of your CPU register it‘s not needed,<br>
> as you always can enfoce what you want by using normal INTEGER<br>
> arithmetic.<br>
> <br>
> b := FFH;<br>
> word16 := 0CAFEH;<br>
> <br>
> or to be absolutely sure (although not needed)<br>
> <br>
> b := FFH MOD 100H;<br>
> word16 := 0CAFEH MOD 10000H;<br>
> <br>
> All those literals are legal INTEGERs on a 32 CPU.<br>
> <br>
> But you can‘t use the same for values completely filling yor register<br>
> that are no valid INTEGERs anymore.<br>
> <br>
> i := 0CAFEBABEH;<br>
> is not going to work, as CAFEBABE needs more than 31 bit to be<br>
> represented as positive INTEGER.<br>
> <br>
> br<br>
> Jörg<br>
--<br>
<a href="mailto:Oberon@lists.inf.ethz.ch" target="_blank">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>
<a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" rel="noreferrer" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
</blockquote></div>