The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,509 other followers

Archive for the ‘Delphi’ Category

Are these really Windows compiler unsupported Delphi Intrinsic Routines?

Posted by jpluimers on 2019/03/19

Odd, the [WayBack/Archive.is] Delphi Intrinsic Routines – RAD Studio indicates quite a few compiler intrinsics are not available on Windows.

I wonder if this list is correct:

Routine Description DCC32 DCC64 DCCOSX DCCAARM DCCIOSARM DCCIOSARM64 DCCIOS32
System.AtomicCmpExchange AtomicCmpExchange is used for comparing and exchanging memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.AtomicDecrement AtomicDecrement is used for decrementing memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.AtomicExchange AtomicExchange is used for exchanging memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.AtomicIncrement AtomicIncrement is used for incrementing memory values. Allowed.png Allowed.png Allowed.png Allowed.png
System.BuiltInArcTan Calculates the arctangent of a given number. Allowed.png Allowed.png
System.BuiltInArcTan2 Calculates the arctangent angle and quadrant of a given number. Allowed.png Allowed.png
System.BuiltInCos Calculates the cosine of an angle. Allowed.png Allowed.png
System.BuiltInLn Calculates the natural logarithm of a real expression. Allowed.png Allowed.png
System.BuiltInLnXPlus1 Calculates the natural logarithm of (X+1). Allowed.png Allowed.png
System.BuiltInLog10 Calculates log base 10. Allowed.png Allowed.png
System.BuiltInLog2 Calculates log base 2. Allowed.png Allowed.png
System.BuiltInSin Calculates the sine of the angle. Allowed.png Allowed.png
System.BuiltInSqrt Calculates the square root of X. Allowed.png Allowed.png
System.BuiltInTan Calculates the tangent of X. Allowed.png Allowed.png

Especially since this compiles fine with the DCC32 compiler:

program CompilerIntrinsicsConsoleProject;

{$APPTYPE CONSOLE}

{$R *.res}

var
  I, J, K: Integer;
begin
  System.AtomicCmpExchange(I, J, K);
  System.AtomicDecrement(I);
  System.AtomicExchange(I, J);
  System.AtomicIncrement(J);
end.

–jeroen

Posted in Delphi, Delphi 10.3 Rio (Carnival), Development, Software Development | Leave a Comment »

delphi – Why was TDataSource created originally? – Stack Overflow

Posted by jpluimers on 2019/03/14

From a while ago [WayBackdelphi – Why was TDataSource created originally? – Stack Overflow

5down voteaccepted

It is all about decoupling and indirection.

And with TDataSource there are two kinds of them:

  • Decoupling the master detail relations (TDataSource is in the same module as the TDataSets that are being bound; the detail TDataSet references the master TDataSet by pointing its’ MasterSource property to the TDataSource that points to the master TDataSet)
  • Decoupling the UI from the business layer (TDataSets are in a DataModule; TDataSource is on the Form/Frame which contains your UI controls, UI controls reference their DataSourceproperty).

Since many components can point to the same DataSource, you can quickly switch which underlying TDataSet they use by just flipping one TDataSource.DataSet property.

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | Leave a Comment »

Link archive: to investigate – Classic compiler (Win32) strings double-free crash because of error in refere…

Posted by jpluimers on 2019/03/12

For my link archige: [WayBack] Classic compiler (Win32) strings double-free crash because of error in reference-counting. Tested with XE2 and 10.1 Berlin Test applications: https://g… – Arioch The – Google+

–jeroen

Posted in Delphi, Development, Software Development | 3 Comments »

IDE Fix Pack 6.4 for Delphi 2009,XE-10.2 Tokyo and 6.4.1 for Delphi 2010 and 10.3 Rio

Posted by jpluimers on 2019/03/12

On my list of things to install soon IDE Fix Pack 6.4 and 6.4.1:

Technically, there is 6.4 that works in Delphi 10.3 Rio Update 1, but it is better to install 6.4.1 as it works with 10.3 and 10.3.1:

The dependencies file looks interesting for good uses list optimisation, given that you compile with all conditional define permutations:

There is a ton of changes, of which I like the bold ones most:

6.4

  • Fixed: Packages with duplicate units may not have caused a fatal compiler error.
  • Added: Support for Delphi 10.3 Rio
  • Added: StyleUtils.inc performance optimizations for faster UI rendering (D10.3)
  • Added: Infinite loop detection in TDebugger.UpdateEventLog
  • Added: Fix for TStringList.IndexOfName bug (RSP-21633)
  • Added: Fix for access violation in the Welcomepage JScript9.dll binding
  • Added: TCustomListBox.ResetContent is skipped if the handle isn’t created yet
  • Added: More STRINGCHECKS-free RTL code (2009/2010)
  • Added: More DFM Streaming optimizations
  • Added: RTL and DFM streaming patches to remove STRINGCHECKS (2009/2010)
  • Added: Removed VclFixPack OutputDebugString calls (2009)
  • Added: FillChar uses Enhanced REP MOVSB/STOSB cpu feature if available for large sizes.
  • Added: Enabled CPU LOCK string assignment optimization for local variables
  • Added: -x-Oe (experimental optimizations) and -x-cgo compiler option extension
  • Added: CodeGen: Remove of some unnecessary push/pop operations
  • Added: Expression Evaluator allows array access to pointers even if the type wasn’t declared with {$POINTERMATH ON}
  • Added: Max number of constants in a function was increased from 64K to 16M (2009-XE3)
  • Added: New compiler option extensions: -x–compileonly, -x–reslist, -x–depfile, -x–unitstats
  • Added: More performance optimization for the DCC64 compiler
  • Added: TStringBuilder.SetLength optimization [RSP-19178] (XE+)
  • Added: TStrings.GetDelimitedText optimization
  • Improved: Slight faster TStringList.IndexOfName optimization for sorted string lists.

6.4.1

  • Fixed: StyleUtils.inc patch contained a hard coded address causing the patch to fail if the DLL’s base address was relocated. (10.3 only)
  • Fixed: TCustomListBox.ResetContent patch crashed with an access violation. (2010 only)

–jeroen

Read the rest of this entry »

Posted in Delphi, Development, Software Development | Leave a Comment »

Smart Pointers code that compiles in FPC and Delphi

Posted by jpluimers on 2019/03/06

Delphi and FPC have different language boundaries, so it is always good to read a thread discussing how to get near-the-edge cases work in both.

This case is about Smart Pointers (here called auto pointers, maybe because auto_ptr is what they used to be called in C++): [WayBack] Hi all, I am trying to make a certain piece of code cross compile between Delphi and FPC. On FPC, it compiles fine but on Delphi I get a [dcc32 Error] P… – Ugochukwu Mmaduekwe – Google+

In the end if comes down to that Delphi does not allow forward-declaration of records (it does for interfaces and classes), but that you do not need a __PAutoPtr_T = ^__TAutoPtr_T, because you can use ^__TAutoPtr_T in parameters.

In Spring4D, they are called Shared/IShared/TShared, see my comment:

Note that since these are reference counted, you might want to call them shared_ptr. If you enforce the single-instance behaviour, observe that in C++ they are now called uniqe_ptr.

In Spring4D this rename has already taken place a while ago: https://bitbucket.org/sglienke/spring4d/commits/e252b81fd3788cf5b82588721f68d00c892deb87

–jeroen

Posted in Conference Topics, Conferences, Delphi, Development, Event, Software Development | 2 Comments »

 
%d bloggers like this: