* * *

Recent Posts

Pages: [1] 2 3 ... 10
Cocoa / TEdit on TToolBar hidden until clicked
« Last post by MISV on Today at 12:28:41 am »
Cocoa built IDE (fpcupdeluxe from today)

Most places edits, combocoxes etc. look correct

But I have a TEdit on a TToolBar which is hidden until clicked. Is this issue known? If not I will try reproduce a smaller test case and submit (my project has a pretty deep nesting of panels etc. so I will need to simplify the test case)

Cocoa / PageControls pages - some pages have content hidden?
« Last post by MISV on Today at 12:26:21 am »
Cocoa built IDE (fpcupdeluxe from today)

About 40% of my pages in TPageControl works - even some complex one

But 60% is hidden... Any idea on what causes this? Some kind of nesting of TScrollBox and TPanels?

If anyone knows what I should look for / investigate i will report back
Third party / Re: Online Package Manager
« Last post by wp on Today at 12:20:46 am »
I uploaded a new version of tvplanit (v1.2). GetMem, could you please update the OPM repository?
Not sure where to report this -

but all my non-visual components captions and icons are upside down on initial load (seems to fix itself when clicking around on pagecontrol loading new page)

Info: Cocoa built IDE (fpcupdeluxe from today)

General / How reliable is HeapTrc?
« Last post by BrainChemistry on Today at 12:01:30 am »
Hi there,

how reliable is HeapTrc in detecting memory leaks? In other words, if it doesn't show any unfree'd memory blocks, is it very likely there are no memory leaks or is it highly dependent on the program design?

[You may skip this additional information: The reason why I ask this is because of this: I have structures in memory which have to be free'd by specific free routines (from shared libraries) for these structures. Anyway, HeapTrc isn't showing unfree'd blocks if I just use Pascal's free routines.]

Thanks for clarification in advance.
Beginners / Re: Bubblesort
« Last post by Thaddy on June 20, 2018, 11:33:00 pm »
It depends on system, but usually an xor swap is slower on intel systems. That's true.
On arm systems it is often faster, though in the sense that on arm the differences seem there, but 20% instead of 50%.
Wikipedia has a neat write up on the xor swap that explains the theory and applicability.
I was just obfuscating  8-) And it is a fun technique  ::) :D :D
Beginners / Re: Bubblesort
« Last post by Zoran on June 20, 2018, 11:06:54 pm »
Not cross platform.... :D My cheeky code works.... and is fast... for a bubblesort... O:-) 8-)

Actually xor swap is slower than swap with temp. But at least it saves four bytes on the stack. :D

This programme:
Code: Pascal  [Select]
  1. program TestSwaps;
  3. uses
  4.   SysUtils;
  6. type
  7.   TSwapType = LongInt;
  8.   TSwapProc = procedure(var M, N: TSwapType);
  10. procedure TempSwap(var M, N: TSwapType);
  11. var
  12.   Temp: TSwapType;
  13. begin
  14.   Temp := M;
  15.   M := N;
  16.   N := Temp;
  17. end;
  19. procedure XORSwap(var M, N: TSwapType);
  20. begin
  21.   M := M xor N;
  22.   N := M xor N;
  23.   M := M xor N;
  24. end;
  26. procedure MeasureSwapTime(const Name: String; SwapProc: TSwapProc);
  27. const
  28.   Iterations = 1000000000;
  29. var
  30.   I: Integer;
  31.   M, N: TSwapType;
  32.   StartTime, EndTime: Extended;
  33. begin
  34.   M := 1;
  35.   N := 2;
  37.   StartTime := 1.0e-3 * TimeStampToMSecs(DateTimeToTimeStamp(SysUtils.Now));
  39.   for I := 1 to Iterations do
  40.     SwapProc(M, N);
  42.   EndTime := 1.0e-3 * TimeStampToMSecs(DateTimeToTimeStamp(SysUtils.Now));
  44.   Write(Iterations, ' calls of ', Name, ' took ');
  45.   Write(Format('%.3N', [EndTime - StartTime]));
  46.   WriteLn(' seconds.');
  47. end;
  49. begin
  50.   MeasureSwapTime('TempSwap', @TempSwap);
  51.   MeasureSwapTime('XORSwap', @XORSwap);
  53.   ReadLn;
  54. end.

Gives these results on my system (Linux Mint 18.3, 64bit)

With -O1:
1000000000 calls of TempSwap took 5.254 seconds.
1000000000 calls of XORSwap took 8.727 seconds.

With -O2:
1000000000 calls of TempSwap took 3.071 seconds.
1000000000 calls of XORSwap took 7.570 seconds.

With -O3 (Only XORSwap is better than with -O2):
1000000000 calls of TempSwap took 3.081 seconds.
1000000000 calls of XORSwap took 5.878 seconds.

With -O4 (no more optimisation here):
1000000000 calls of TempSwap took 3.060 seconds.
1000000000 calls of XORSwap took 5.891 seconds.
General / Re: TTaskdialog -> console app : error 1407
« Last post by scons on June 20, 2018, 10:42:10 pm »
Thanks for your responses, got me thinking,

Menu : Project -> Project Options ->Application -> For Windows -> enabeling the checkbox "Use manifest resource (and enable themes)"
did the trick no error, runs fine.

Thanks !
FPC development / Re: Dynamic array extensions ?
« Last post by Thaddy on June 20, 2018, 10:32:10 pm »
Neat solution!
FPC development / Re: Dynamic array extensions ?
« Last post by PascalDragon on June 20, 2018, 10:30:14 pm »
I would like to draw your attention to a new feature announced on the FPC mailing list: Dynamic array extensions. In short:

- support for array constructors using "[...]" syntax
- support for Insert(), Delete() and Concat()
- support for "+" operator
- support for dynamic array constants (and variable initializations)

Sounds ok, however: The "+" operator is effectively an alias for concat(), and it will be an intrinsic, which means that existing "+" operator overloads for dynamic arrays will no longer compile. Intrinsic operators cannot be overloaded, hence it will no longer be possible to custom define the "+" operator to do a mathematical elementwise addition of numerical vectors/matrices.

With the "+" operator hijacked, all other obvious mathematical operators i.e. -, *, / for numeric vectors are effectively obliterated. We would either have to revert to procedural style as in turbo pascal days, such as in function add (V1, V2: TVector): TVector; or declare extra container classes for numeric vectors / matrices, to which mathematical operators can be applied.

What is your opinion on that  ?

Addendum to that: the "+" operator is now connected to a "ArrayOperators" modeswitch.

If the modeswitch is active then the "+" operator overload is not possible and the compiler will warn if such an overload is in scope. If the modeswitch is not set, then everything is as before.

The modeswitch is enabled by default in Delphi modes, because that's why the feature was added. To disable the modeswitch there use this:

Code: Pascal  [Select]
  1. {$mode Delphi}
  2. {$modeswitch ArrayOperators-} // Note the "-"
Pages: [1] 2 3 ... 10


Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus