Jump to content
Registration disabled at the moment Read more... ×

Leaderboard


Popular Content

Showing content with the highest reputation on 08/01/25 in all areas

  1. Vincent Parrett

    Need help investigating an app crash

    I would try using MadExcept or Eurekalog for capturing unhandled exceptions - in my experience they produce far more reliable and useful information than JCL.
  2. Visualize complex multi-dimensional data using #TeeBI Composer control. Minimal code, automatic output. https://github.com/Steema/TeeBI/tree/master/demos/delphi/Visualization/Composer
  3. On this atleast syuntax is readable X := if Left < 100 then 22 else 45; For example C-syntax is not what I really can say that I like. int result = (x > 5) ? 10 : 20; even worse if writte like this int result=(x>5)?10:20; Syntax highlighting saves a bit for sure but still easy to miss those... One character operator thingies... -Tee-
  4. Yeah, right 🤦‍♂️ More syntactic sugar, the compiler codegen is still a joke, and we still haven't got SIMD intrinsics. The only time I've ever wished for a ternary operator was when porting C code and being in a rush. But I wouldn't mind all this fluff (since I don't have to use it) - if they would also throw an occasional bone to those of us that need low level performance. Yes, but you don't have to use it.
  5. I didn't say it was *submitted* for merge into FPC. I said it was *created*. There is a patch file attached to the forum post that I linked to: "It's roughly 30 lines of code and took 15 minutes to create the attached patch for fpc main"
  6. The difference between a ternary operator and iif<T> as you describe is that both operators are not evaluated with the ternary operator. Only the one satisfying the condition For example isVisible:=if Assigned(Foo) then Foo.Visible else False which will work vs isVisible:=iif<Boolean>(Assigned(Foo),Foo.Visible,False) which will crash if Foo is not assigned, according to the implementation you describe.
  7. We have released new updates of all products: Pascal Analyzer 9.17 Pascal Expert 9.17 Pascal Browser 3.5.38 It is possible to download evaluation versions, and also to view the entire documentation online. Go to Peganza for more information. If you are new to the products, we recommend our Youtube video (18 minutes) that describes Pascal Analyzer, with examples and a short demo. These are the changelogs for these updates: Pascal Analyzer 9.17.0 July 15, 2025 fixed an issue with STWA5-"Possible bad pointer usage" improved parsing of constant declarations new section in Warnings Report, WARN64-"Misformed call to Format function" checks if calls have the correct number of arguments and that the types are correct fixed a problem with CONV30-"Private can be changed to strict private" and CONV31-"Protected can be changed to strict protected" fixed issue with WARN46-"Local variables that are set but not later used" WARN3-"Variables that are referenced but never set" does not warn for variables of type TFormatSettings, needs extended analysis to provide accurate warnings fixed an edge-case error that could affect STWA6-"Possible bad typecast" Pascal Expert 9.17.0 July 15, 2025 fixed an issue with STWA5-"Possible bad pointer usage" improved parsing of constant declarations new section in Warnings Report, WARN64-"Misformed call to Format function" checks if calls have the correct number of arguments and that the types are correct fixed a problem with CONV30-"Private can be changed to strict private" and CONV31-"Protected can be changed to strict protected" fixed issue with WARN46-"Local variables that are set but not later used" WARN3-"Variables that are referenced but never set" does not warn for variables of type TFormatSettings, needs extended analysis to provide accurate warnings fixed an edge-case error that could affect STWA6-"Possible bad typecast" Pascal Browser 3.5.38 July 15, 2025 improved parsing of constant declarations
  8. Rollo62

    Anonymous instance methods

    Yes, thats nice and useful, you can also extend this a bit, to avoid dangling pointers. See these rough ideas ... destructor TAnonProc.Destroy; begin if (Owner is TButton) and (TMethod(TButton(Owner).OnClick).Data = Self) then begin TButton( Owner ).OnClick := nil; // Ensure to remove dangling Pointer end; inherited; end; or you could even separate the Owner from the Observer type TAnonProc = class(TComponent) private FProc: TProc<TObject>; procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure OnSender(Sender: TObject); public constructor Create(AOwner, AObserved: TComponent; AProc: TProc<TObject>); end; constructor TAnonProc.Create(AOwner, AObserved: TComponent; AProc: TProc<TObject>); begin inherited Create(AOwner); // Owner = Form FProc := AProc; AObserved.FreeNotification(Self); // register observer if AObserved is TButton then TButton(AObserved).OnClick := OnSender; end; procedure TAnonProc.Notification(AComponent: TComponent; Operation: TOperation); begin if (Operation = opRemove) and (AComponent is TButton) then begin TButton(AComponent).OnClick := nil; // Clear the Pointer end; inherited; end; procedure TAnonProc.OnSender(Sender: TObject); begin if Assigned(FProc) then FProc(Sender); end; //.......................... TAnonProc.Create(Self, Button1, procedure(Sender: TObject) begin Caption := 'Click!'; end);
  9. I wonder whether there will be a code formatter that supports this. Given that they deprecated the existing one since Delphi 11, I somehow doubt it.
×