Sign in Join
Wiki copytemporary

User Changes 2.4.2: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: User Changes 2.4.2

OldNewLine
1+## About this page
2+
3+Below you can find a list of intentional changes since the [[User Changes 2.4.0|previous release]] that can change the behaviour of previously working code, along with why these changes were performed and how you can adapt your code if you are affected by them.
4+
5+## All Systems
6+
7+### Language changes
8+
9+#### Abstract and Sealed class modifiers
10+
11+- **Old behaviour**: It was possible to have *abstract* or *sealed* fields immediately following the *class* keyword.
12+- **New behaviour**: The compiler now interprets *abstract* and *sealed* as class modifiers if they immediately follow the *class* keyword.
13+- **Example**:
14+
15+``` pascal
16+{$mode objfpc}
17+type
18+ TSomeClass1 = class
19+ abstract: integer;
20+ end;
21+
22+ TSomeClass2 = class
23+ sealed: integer;
24+ end;
25+```
26+
27+The above code will no longer compile.
28+
29+- **Reason**: *abstract* and *sealed* are now the class modifiers, which is Delphi-compatible
30+- **Remedy**: Separate the *abstract* or *sealed* field name from the *class* keyword with a visibility section (*published*, *public*, ...) or with another field declaration.
31+
32+### Types changes
33+
34+#### TObject class declaration
35+
36+- **Old behaviour**: TObject class did not have UnitName, Equals, GetHashCode, ToString methods.
37+- **New behaviour**: Those methods were added to the TObject class.
38+- **Effect**: Compiler produces warnings in delphi mode and errors in objfpc mode if user classes have the same identifier(s).
39+- **Reason**: Delphi compatibility, these methods are present in the TObject class since Delphi 2009.
40+- **Remedy**: Adjust your code so it does not conflict with the TObject class members. Override TObject method where is possible or rename/reintroduce identifier in other case.
41+
42+### Unit changes
43+
44+#### Daemonapp unit moved to new fcl-extras package
45+
46+- **Old behaviour**: unit Daemonapp resided in package fcl-base.
47+- **New behaviour**: unit Daemonapp resides in package fcl-extra.
48+- **Effect**: On OSes that have a package for every directory in packages, daemonapp seems to be missing if fcl-extra is not installed.
49+- **Reason**: Breaking dependency cycles in the FCL, most notably on Windows.
50+- **Remedy**: On operating systems where a package in packages/ corresponds to a separate package to install (like on Debian), an additional package corresponding to fcl-extra must be installed
51+
52+#### DOM unit: no longer uses avl_tree for node search optimization
53+
54+Note: This is an implementation-only change. Nevertheless, it's worth documenting and explanation.
55+
56+- **Old behaviour**: each 'parent' DOM node (Elements and Attributes, in the first place) had an associated TAvgLvlTree object, that was used as child node node index, and intended to speed up the `TDOMNode.FindNode` method by replacing linear search by binary search.
57+- **New behaviour**: the TAvgLvlTree is no longer used, and `TDOMNode.FindNode` method uses a linear search.
58+- **Effect**: The XML parsing speed has increased about twice, and average memory usage of a DOM document has decreased by about 75%. The performance of the `TDOMNode.FindNode` method, and methods of TXMLConfig class (xmlcfg unit), may become lower in some scenarios.
59+- **Reason**: The optimization offered by child node indexing was applicable only to one particular usage case: XML config files, which require all node names within a single parent to be unique. The memory/performance penalty caused for all other usage cases has become way too big.
60+- **Remedy**: If you experience slowdown of your code using TXMLConfig class from xmlcfg unit, consider replacing xmlcfg with a newer xmlconf unit. Then, use `OpenKey` and `CloseKey` methods to limit the amount of searching in the DOM.
61+- **Example**:
62+
63+``` pascal
64+// the code like this
65+uses xmlcfg;
66+...
67+begin
68+ config.WriteString('the/very/long/path/value1', string1);
69+ config.WriteString('the/very/long/path/value2', string2);
70+ config.WriteString('the/very/long/path/value3', string3);
71+ ...
72+end;
73+
74+// can be changed to:
75+uses xmlconf;
76+...
77+begin
78+ config.OpenKey('the/very/long/path');
79+ config.WriteString('value1', string1);
80+ config.WriteString('value2', string2);
81+ config.WriteString('value3', string3);
82+ config.CloseKey;
83+end;
84+// in this example, 'the/very/long/path' will be searched only once rather than 3 times,
85+// which will improve the performance.
86+```
87+
88+#### MacOSAll unit: changed parameter types
89+
90+- **Old behavior**: The old headers were a combination of the original Apple-written Pascal headers and translated C headers. The Pascal headers were written for compilers that did not support unsigned 32 bit types, and in many cases used "var" parameters where the actual parameter was an array in C.
91+- **New behaviour**: The new headers have all been translated from the latest Mac OS X 10.6 headers for 64 bit and iPhoneOS support. As a result, several parameters types have changed and a number of units that no longer exist under Mac OS X have been removed.
92+- **Remedy**: Either adjust your code, or file bug reports asking to revert to the old signatures (especially for deprecated routines that won't be updated in the future anymore anyway, this should be no problem).
93+- **Changes:**
94+ - Several units have been removed because they were specific to Classic Mac OS
95+ - Many cases where signed parameters were turned into unsigned parameters and vice versa, too many to list (due to differences between the classic Pascal headers and the new C headers)
96+ - ATSFontFindFromContainer: ioArray var -\> ptr because array
97+ - ATSFontGetFileSpecification: oFile FSSpec -\> ATSFSSpec (was translation error?)
98+ - CFNetworkCopyProxiesForAutoConfigurationScript: got extra CFErrorRef para
99+ - CMGetDeviceFactoryProfiles: defaultProfID var -\> ptr, because can be nil
100+ - CMIterateColorDevices: seed and count var -\> ptr, because can be nil
101+ - CMIterateDeviceProfiles: seed and count var -\> ptr, because can be nil
102+ - CMSetDeviceProfiles: profileScope and deviceProfiles const -\> ptr, because can be nil
103+ - ConvertFromUnicodeToScriptCodeRun: oScriptCodeRuns var -\> ptr because array
104+ - ConvertFromUnicodeToTextRun: oEncodingRuns var -\> ptr because array
105+ - CreateUnicodeToTextRunInfo: iUnicodeMappings var -\> ptr because array
106+ - DCMCreateFieldInfoRecord: findMethods var -\> ptr because array
107+ - DCMGetFieldFindMethods: findMethods var -\> ptr because array
108+ - GetIconRefFromFileInfo: outlabel var -\> ptr because can be nil
109+ - HIImageViewCreate: last parameter ControlRef -\> HIViewRef
110+ - HIViewNewTrackingArea: outRef var -\> ptr because can be nil in 10.5+
111+ - LAGetEnvironmentList: environmentList var -\> ptr because array
112+ - LAListAvailableDictionaries: dictionaryList and opened var -\> ptr because array
113+ - LSGetApplicationForURL: outAppRef and outAppURL var -\> ptr because can be nil
114+ - LocaleOperationGetLocales: localeVariantList var -\> ptr because can be nil
115+ - MPWaitOnQueue: param1-3 value -\> var because "void **" in C
116+ - QTVRSetBackBufferImagingProc: areasOfInterest var -\> ptr because array
117+ - QueryUnicodeMappings: oReturnedMappings var -\> ptr because array
118+ - TECConvertTextToMultipleEncodings: outEncodingsBuffer var -\> ptr because array
119+ - TECFlushMultipleEncodings: outEncodingsBuffer var -\> ptr because array
120+ - TECSniffTextEncoding: numErrsArray and numFeaturesArray var -\> ptr because array
121+ - FSCreateResFile: catalogInfo const -\> ptr because can be nil
122+
123+#### Sockets unit, sockaddr_in type and aliases
124+
125+- **Old behavior**: This record is a variant record (union) of the POSIX naming (2.0.x+) and the old 1.0.x naming (mostly without sin_ prefix), to ease migrating 1.0.x -\> 2.0.x codebases.
126+- **New behaviour**: Since the migration period is long over, "Deprecated" modifiers have been added to the 1.0.x fields in preparation for their removal in a later version. This might trigger warnings.
127+- **Reason**: These legacy fields were never documented properly as legacy, and with 2.4.0 "deprecated" modifier on fields now works reliably.
128+- **Remedy**: If you are still using the old 1.0.x fieldnames, use the new sin_* prefixed fields as much possible to avoid breakage using future versions.
129+
130+#### System.TTime
131+
132+- **Old behavior**: This type only existed on Unix and was introduced in 2.0 as an "Pascal friendly" alias for time_t.
133+- **New behaviour**: This type is now defined as "type tdatetime"
134+- **Reason**: Delphi compatibility. Delphi defines ttime and tdate in system.
135+- **Remedy**: Use unixtype.ttime or time_t. Be aware that importing (base)Unix units change the meaning of the ttime type.
136+
137+## Windows
138+
139+#### Microsoft Windows 95 support
140+
141+- **Old behaviour**: FPC-compiled programs, including FPC itself, ran on Windows 95.
142+- **New behaviour**: FPC-compiled programs refuse to start on Windows 95.
143+- **Reason**: The 2.4.2 version of the Windows system unit references a function that is not present in the Windows 95 version of "kernel32.dll".
144+- **Remedy**: See [RTL fix for Windows 95 support](http://www.freepascal.org/rtl/win95-rtl-242-fix.html).
145+
146+## Previous release notes
147+
148+---
149+*From the Free Pascal wiki, page "User Changes 2.4.2", as it stood on 2020-03-03 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
150+Category: FPC User Changes by release
151+Category: Release Notes

Back to history