[fpc-devel] registry changes

Martin lazarus at mfriebe.de
Mon Dec 24 12:13:39 CET 2012


Writing this from my laptop I do not currently have all the various 
checkouts to look at the exact changes myself. But enquiring based on 
the reports I have read.

http://bugs.freepascal.org/view.php?id=23523
> From FPC trunk r23202 log:
> ----
> * Include regdef.inc only if XMLREG is defined (non-Windows 
> platforms). On Windows it is not needed since the Windows unit is 
> included and it has all necessary declarations. Keeping duplicate 
> declarations in regdef.inc on Windows is dangerous since it leads to 
> out of sync problems.
> * Cleanup regdef.inc to contain only necessary types and constants to 
> work with registry unit on non-Windows platforms.
> ---

I could not find any remarks on the user changes for trunk

It appears this change breaks existing units. Technically easy to fix, 
it complicates user code by adding a need for fidef in the uses clause, 
so that compiling on windows includes the windows unit (which would 
break compiling on none windows.)

I understand that code duplication should be avoided.
Given that before registry code only required one unit, and no undef, I 
did wonder if a simple forward declaration  (as replacement) was 
considered, and if so, why if was not chosen.

That is as an example in 2.4 the include file in unit registry defines 
it's own
     HKEY_LOCAL_MACHINE    = HKEY($80000002);

That of course is not good, as it duplicates the define in windows, with 
the risk of not being updated, should the value change.

But it could have defined
    HKEY_LOCAL_MACHINE    = windows.HKEY_LOCAL_MACHINE

Then the compilation of other units would not have been broken


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20121224/e29c134a/attachment.html>


More information about the fpc-devel mailing list