Hi,

OK. I'll add needed defines to registry unit for Windows using this method:

HKEY_LOCAL_MACHINE    = windows.HKEY_LOCAL_MACHINE

Yury Sidorov, j...@cp-lab.com


----- Original Message ----- From: Martin
To: FPC developers' list
Sent: Monday, December 24, 2012 1:13 PM
Subject: [fpc-devel] registry changes


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






_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel _______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to