[Oberon] OBNC Sets incorrect output

Joe Turner medianjoe at mailfence.com
Sun Mar 20 13:03:46 CET 2022


Hi Jorg,

Sorry, I don't understand your point. I know that the set size is 32 {0..31} but if if OBNC is built with --c-int-type=long it should be 64 {0..63}. So why is my code not giving the correct output for sets which contain elements > 31?

March 20, 2022 12:20:44 PM CET "Jörg" <joerg.straube at iaeth.ch> wrote:If the largest set element is 31, the set size is 32 {0..31}
Jörg

Am 20.03.2022 um 10:37 schrieb Joe Turner <medianjoe at mailfence.com>:


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--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon

--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon

-- 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/8ad56cb2/attachment.html>


More information about the Oberon mailing list