[Oberon] OBNC Sets incorrect output

Joe Turner medianjoe at mailfence.com
Sun Mar 20 10:36:26 CET 2022


If you build OBNC on a 64 bit system with --c-int-type=long you can use integers between 0-63 in sets. I confirmed this using the code provided on the FAQ page at the OBNC site (slightly modified because I removed the procedure):

MODULE setSize;
IMPORT Out;
VAR
  x : INTEGER;
  s : SET;
BEGIN
  x := -1;
  s :=-{};
  REPEAT
    INC(x);
    EXCL(s,x)
  UNTIL s = {};
  Out.Int(x,4);
  Out.Ln
END setSize.

The output is 63.

However, the following code should produce the output : 31  32. 

MODULE testsets;
IMPORT Out;
VAR
  i  : INTEGER;
  x,y,z : SET;
BEGIN
  x := {31,32,33};
  y := {33,34,35};
  z := x - y;  
  FOR i := 31 TO 35 DO
    IF i IN z THEN 
      Out.Int(i,4) 
    END
  END;   
  Out.Ln
END testsets.

But it doesn't. The output is 31. Other set operations also produce output limited to a maximum set size of 31. 

-- Sent with https://mailfence.com  Secure and private email
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20220320/5b72e940/attachment.html>


More information about the Oberon mailing list