View Issue Details

IDProjectCategoryView StatusLast Update
0035795FPCCompilerpublic2019-07-09 14:30
ReporterKai BurghardtAssigned ToMarco van de Voort 
Status resolvedResolutionfixed 
Platformx86_64OSGNU/LinuxOS Version4.2.0
Product Version3.0.4Product Build 
Target VersionFixed in Version 
Summary0035795: high() and low() in conjunction with constant sets produce bogus results
Descriptionhigh() and low() do not evaluate as the lowest or highest possible element in a constant set.
Steps To Reproduceprogram setLimits(input, output, stderr);
    m = [0, 1, 2, 3];
    t = high(m);
    n: set of 0..3;
    writeLn(t); // prints 255 🙁
    n := [0, 1];
    writeLn(high(n)); // prints 3
TagsNo tags attached.
Fixed in Revision
Attached Files


Marco van de Voort

2019-07-05 11:57

manager   ~0117076

So basically for inferred types (the set range for "m" is not explicitely stated), the set has the maximum size of 256.

Seems normal to me.

Serge Anvarov

2019-07-05 18:43

reporter   ~0117090

That is, as if declared
    m: set of Byte = [0, 1, 2, 3];
By the way, in Delphi you can not use the functions High and Low for the set.

Kai Burghardt

2019-07-06 15:26

reporter   ~0117099

Huh, alright. It’s accordance with the documentation of low()/high() then.

I simply wasn’t aware all sets of integers are actually `set of byte`. I wish low()/high() would return different dates, since the limits of a byte a generally known.

Kai Burghardt

2019-07-09 13:43

reporter   ~0117121

I think, this issue can be closed. I’m looking for a maximum and minimum function working on sets [not arrays]. Apparently this does not exist.

Marco van de Voort

2019-07-09 14:30

manager   ~0117123

Close as request, Serge: Delphi does support for in on sets, strangely enough.

Marc ones state it was the main positive thing about, the ability to iterate over anonymous sets.

Issue History

Date Modified Username Field Change
2019-07-05 01:30 Kai Burghardt New Issue
2019-07-05 11:57 Marco van de Voort Note Added: 0117076
2019-07-05 18:43 Serge Anvarov Note Added: 0117090
2019-07-06 15:26 Kai Burghardt Note Added: 0117099
2019-07-09 13:43 Kai Burghardt Note Added: 0117121
2019-07-09 14:30 Marco van de Voort Assigned To => Marco van de Voort
2019-07-09 14:30 Marco van de Voort Status new => resolved
2019-07-09 14:30 Marco van de Voort Resolution open => fixed
2019-07-09 14:30 Marco van de Voort FPCTarget => -
2019-07-09 14:30 Marco van de Voort Note Added: 0117123