Jump to content

Stefan Glienke

Members
  • Content Count

    1430
  • Joined

  • Last visited

  • Days Won

    142

Everything posted by Stefan Glienke

  1. My number one argument for constraining on class in a generic type argument when possible is that you then can build most of the generic in a non generic layer and just put a small generic layer on top. That makes for less bloat.
  2. Stefan Glienke

    Filter Exception causing debugger errors

    All that I am using which would be mostly 10.1 and 10.4 - I would guess its related to the type of the exception - I usually see this with hardware exceptions such as AV or SO.
  3. Stefan Glienke

    On the use of Interposers

    And that is why SRP goes down the drain, cyclomatic complexity increases, potential bugs increase, stuff gets broken - mostly in such swiss army knife classes. And what is complete - that differs for everyone.
  4. Stefan Glienke

    On the use of Interposers

    Topic splitting can easily done by mods. Personally I would welcome if this was done more often so different things can continue being discussed in their own threads.
  5. Stefan Glienke

    On the use of Interposers

    Correct, that's why you close the IDE before you switch the branch
  6. Stefan Glienke

    On the use of Interposers

    If you are referring to switching between different versions of them I can only suggest putting those (yes the binaries, so dcu, dcp, bpl) into vcs - git lfs for example does a fine job.
  7. Stefan Glienke

    On the use of Interposers

    I would never use interposer classes for that but simply run a one time search and replace for all occurences of the third party controls with my own.
  8. Stefan Glienke

    On the use of Interposers

    Interposer classes are only good for components/controls that you already placed on forms because you can keep using them as is while you would need to replace a lets say TButton with TMyAwesomeButton. Where I also like to use them is for extending DUnit as I can use my unit with the TTestCase class then instead of the DUnit one and add functionality - but I would stay away from using it on RTL classes. Funny story: just yesterday we had a sudden compile error from a unit that was not touched in months. A class that was implementing an interface and the compiler complained about missing 2 method implementations. Turned out it was caused by the fact that a junior had added a TAction interposer class into a form unit. That unit was used in the unit which now failed - because those interface methods had TAction in their signature and now they did not match anymore.
  9. Stefan Glienke

    DUNIT X memory leak checking

    Take a look at the screenshot you posted yourself...
  10. Stefan Glienke

    What is wrong with TStringList

    Loading an entire file into a TStringList is a bad way to begin with tbh yet often the most easy way because there are no nice to use alternatives out of the box.
  11. Stefan Glienke

    GExperts 10.4 dll compiled with Delphi 10.4.1 in Delphi 10.4.0

    Yep, that's the new virtual method that got added in 10.4.1 which is causing AVs and stuff in plugins compiled with 10.4.0 when you have some form in it inheriting from TDesktopForm or TDockableForm because then the VTables don't match.
  12. (not enough information to give an informed suggestion) - anyhow that was not the question of this topic - as a mod/admin you should not contribute to totally derailing threads 😉
  13. That would very much depend on the criteria by whom they are looked up, if that criteria changes and how often elements are added/removed don't you think?
  14. Stefan Glienke

    Record Alignement and Delphi 10.4.1

    Reported: https://quality.embarcadero.com/browse/RSP-30890
  15. Stefan Glienke

    Record Alignement and Delphi 10.4.1

    The offset in the code is correct but the binary layout of the classes are not - here is the dump of the memory layout from the defect: --- TPdfObject --- offset: 4 size: 1 FObjectType: TPdfObjectType offset: 5 size: 4 FObjectNumber: Integer offset: 9 size: 4 FGenerationNumber: Integer offset: 13 size: 1 FSaveAtTheEnd: Boolean --- TPdfStream --- offset: 14 size: 2 ---PADDING--- offset: 16 size: 4 FAttributes: TPdfDictionary offset: 20 size: 4 FSecondaryAttributes: TPdfDictionary offset: 24 size: 1 FDoNotEncrypt: Boolean offset: 25 size: 4 FFilter: AnsiString offset: 29 size: 4 FWriter: TPdfWrite --- TPdfObjectStream --- offset: 31 size: 4 fObjectCount: Integer offset: 35 size: 4 fAddingStream: TPdfWrite offset: 39 size: 4 fObject: :TPdfObjectStream.:2 offset: 43 size: 1 ---PADDING--- size: 48 So the [ebx+$1d] is correct ($1d = 29) - but the starting offset in TPdfObjectStream is wrong. With align Word it looks like this: --- TPdfObject --- offset: 4 size: 1 FObjectType: TPdfObjectType offset: 5 size: 1 ---PADDING--- offset: 6 size: 4 FObjectNumber: Integer offset: 10 size: 4 FGenerationNumber: Integer offset: 14 size: 1 FSaveAtTheEnd: Boolean --- TPdfStream --- offset: 15 size: 1 ---PADDING--- offset: 16 size: 4 FAttributes: TPdfDictionary offset: 20 size: 4 FSecondaryAttributes: TPdfDictionary offset: 24 size: 1 FDoNotEncrypt: Boolean offset: 25 size: 1 ---PADDING--- offset: 26 size: 4 FFilter: AnsiString offset: 30 size: 4 FWriter: TPdfWrite --- TPdfObjectStream --- offset: 34 size: 4 fObjectCount: Integer offset: 38 size: 4 fAddingStream: TPdfWrite offset: 42 size: 4 fObject: :TPdfObjectStream.:2 offset: 46 size: 2 ---PADDING--- size: 52
  16. I would use the Exit version and put the appending new record into its own method.
  17. Stefan Glienke

    Dynamic arrays and copying

    procedure TestAddRowData(); begin lValues := [ ['one', 1, '1one'], ['two', 2, '2two'], ['three', 3, '3three'] ]; // or SetLength(lValues, 3, 3); lValues[0,0] := 'one'; lValues[0,1] := 1; lValues[0,2] := '1one'; lValues[1,0] := 'two'; lValues[1,1] := 2; lValues[1,2] := '2two'; lValues[2,0] := 'three'; lValues[2,1] := 3; lValues[2,2] := '3three'; end;
  18. How to use open array parameters to handle array subranges: https://delphisorcery.blogspot.com/2020/09/open-array-parameters-and-subranges.html
  19. Stefan Glienke

    Open array parameters and subranges

    Ugh, nasty sh*t - can repro in earlier versions than 10.4 as well. The compiler trips over the type inference - need to write MergeSort<T>(...) I would guess it spirals down into some endless loop trying to infer whatever comes back from that tricked Slice call. Updated the blog post - thanks
  20. Stefan Glienke

    DUNIT X memory leak checking

    https://bitbucket.org/shadow_cs/delphi-leakcheck/src/master/ scroll down to "DUnitX integration"
  21. Stefan Glienke

    Versions in GX_CondDefine.inc are wrong

    It's just in the comments but anyhow - from line 66 onwards the version is wrong (both 2007 versions were 11, 2009 was 12, 13 was skipped and so on, 10.4 is 27 - hence the 270 suffix on the packages) See: https://delphi.fandom.com/wiki/Delphi_Release_Dates
  22. Stefan Glienke

    Grep search empty window with 10.4.1

    Then you just did not get the issue yet. I am always compiling GExperts myself and I have seen this glitch with 10.4.1. No steps to repro yet though
  23. Stefan Glienke

    remove ExplicitXxxx properties

    Here is the explanation: http://jedqc.blogspot.com/2006/02/d2006-what-on-earth-are-these-explicit.html
  24. Stefan Glienke

    Use of Ansistring in Unicode world?

    When David wrote "Andy" he was referring to "Andreas Hausladen"
  25. if GetTypeKind(T) = tkClass then PObject(@item)^.Free; RTL still uses DisposeOf (which you also need to if you want to support ARC before 10.4) - look into TObjectList<T>.Notify
×