Unexpected Enumeration Type low and high values lazarus / 62-General ---------------------------------------------------------------------- 440bx · 2025-10-18 22:36 Hello, Consider the following code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program _EnumRange; type  WideEnum =  (   LoWideEnum = low(int64),   HiWideEnum = high(int64)  ); begin  writeln(' low(int64): ',  low(int64));  writeln('high(int64): ', high(int64));   writeln;   writeln(' low(WideEnum): ',  ord(low(WideEnum)));  writeln('high(WideEnum): ', ord(high(WideEnum)));   readln;end.                             the low and high of int64 are: Quote low(int64): -9223372036854775808 high(int64): 9223372036854775807 while the low and high of the enumeration type are: Quote low(WideEnum): -1 high(WideEnum): 0 Considering that enumerations use a maximum of 4 bytes, it is not a surprise that the range is not what has been declared in the enumeration itself. What is a bit of a surprise is that the compiler emits no warning, no hint, no nothing about the loss of significant digits in the type. Also, the resulting range due to bit truncation, while correct, is not exactly intuitive, reinforcing the fact that some sort of warning from the compiler would be very useful in that situation. Personally, I think the compiler should emit some message informing the programmer that it cannot honor such a type definition. Comments welcome. ---------------------------------------------------------------------- Martin_fr · 2025-10-18 22:51 Seems that this is fixed in 3.3.1. I get Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i project1.lpr(7,27) Error: Enumeration symbols can only have values in the range of -2^31 to 2^31-1project1.lpr(9,3) Error: Enumeration symbols can only have values in the range of -2^31 to 2^31-1 ---------------------------------------------------------------------- 440bx · 2025-10-18 22:53 Quote from: Martin_fr on October 19, 2025, 12:51:26 amSeems that this is fixed in 3.3.1. That's great. By any chance, do you happen to know if that fix is also included in the upcoming v3.2.4 ? ---------------------------------------------------------------------- Martin_fr · 2025-10-18 23:29 Quote from: 440bx on October 19, 2025, 12:53:20 amBy any chance, do you happen to know if that fix is also included in the upcoming v3.2.4 ? I do not know. But my recent 3.2.3 does not seem to have it. So likely the answer is no. (not sure if or what may still be merged after the RC) ---------------------------------------------------------------------- 440bx · 2025-10-18 23:32 Thank you Martin.