Re: [fpc-devel] Unexpected "Range check error while evaluating constants" when compiling for Win64
On Sun, Feb 12, 2023 at 10:43 PM Yuriy Sydorov via fpc-devel wrote: > Error "Range check error while evaluating constants (18446744071562067969 > must be between -2147483648 and 4294967295)" > is wrong here: > > property RootKey: HKey read FRootKey write FRootKey default HKEY_CURRENT_USER; > > Since HKEY = THandle = QWord on Win64, the reported range for it is incorrect. Reported: https://gitlab.com/freepascal.org/fpc/source/-/issues/40148 (with simplified example). -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Unexpected "Range check error while evaluating constants" when compiling for Win64
On Mon, Feb 13, 2023 at 8:20 AM Ondrej Pokorny via fpc-devel wrote: > I wouldn't publish the HKEY property but create an own enumeration for it: > > TRegKey = (rgClassesRoot, rgCurrentUser, ) > ... > > Then make a simple transformation to HKEY: > > RegKeyToHKey: array[TRegKey] of HKEY = (HKEY_CLASSES_ROOT, > HKEY_CURRENT_USER, ...); Yep, thought of that as too. Perhaps the best options. Thanks. -- Bart ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] Unexpected "Range check error while evaluating constants" when compiling for Win64
On Mon, 13 Feb 2023, Ondrej Pokorny via fpc-devel wrote: On 12.02.2023 23:08, Bart via fpc-devel wrote: On Sun, Feb 12, 2023 at 10:47 PM Jonas Maebe via fpc-devel wrote: Afaik it's because "default" doesn't support qword values, iirc because of (at least old) Delphi compatibility. OK, I removed the "default". Theoretically would that lead to problems when storing the value in lfm and reading it back using different bitness versions of Lazarus? Should I even publish such a property? (I don't think Lazarus has a property editor for HKEY...) I wouldn't publish the HKEY property but create an own enumeration for it: TRegKey = (rgClassesRoot, rgCurrentUser, ) and publish this instead. Pro: you can put only valid values into the property and object inspector shows you nice enum names instead of strange integers. Then make a simple transformation to HKEY: RegKeyToHKey: array[TRegKey] of HKEY = (HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, ...); Yes, I also think this is the best solution... Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel