Jump to content

Stefan Glienke

Members
  • Content Count

    1428
  • Joined

  • Last visited

  • Days Won

    141

Everything posted by Stefan Glienke

  1. Stefan Glienke

    TestInsight 1.2 released

    The fact that I mention a version number when resolving an issue does not imply that this version is already publicly available - in the future, I will use the words "will be fixed" to refer to a not yet released version. During my vacation, I stayed away from anything programming plus I got new hardware both at home and in the office and neither has all Delphi versions installed yet which are required to create a new setup.
  2. Stefan Glienke

    TRegEx.IsMatch question

    https://www.regular-expressions.info/anchors.html
  3. Stefan Glienke

    How does the "Address Space Randomization (ASLR)" actually work

    If stuff blows up with ASLR under 64bit then this is almost certainly because some code is calculating addresses wrong or unintentionally using 32bit data types where 64bit is needed which did not blow up without ASLR because it never had values higher than maxint. Often this can be caused by incorrect Winapi usage such as this
  4. Stefan Glienke

    How does the "Address Space Randomization (ASLR)" actually work

    That's why you use things like madExcept or EurekaLog - even with ASLR enabled I get a proper call stack from an AV with madExcept.
  5. Which has been a solved problem for quite some - it's called IntroSort - no language I know uses plain QuickSort as their default standard library sort these days. If not IntroSort they might use TimSort.
  6. That's some weird implementation of a lower bound binary search tbh Not true - in a lower bound binary search you keep on binary searching until your range got down to 1 element - with a loop you turn O(log n) into O(n)
  7. Stefan Glienke

    How does the "Address Space Randomization (ASLR)" actually work

    https://security.stackexchange.com/questions/18556/how-do-aslr-and-dep-work
  8. The answer still is yes - your code actually mutated the stack - all proposed answers avoided that - some even avoided any allocation and mine even gave you a drop-in solution. The only question that could be answered with "No" would have been: Is there any solution to this problem where I don't have to write any code for?
  9. Yes. If you wanted to know if there is any method that does that then you should have expressed your question more precisely. But hey let's ask a vague question and then offend anyone providing help by ignoring them.
  10. type TMyStack<T> = class(TStack<T>) function Peek(indexFromTop: Integer): T; overload; inline; end; {$IF RTLVersion < 33} type TStackAccess<T> = class(TEnumerable<T>) FItems: TArray<T>; property List: TArray<T> read FItems; end; {$IFEND} function TMyStack<T>.Peek(indexFromTop: Integer): T; begin Result := {$IF RTLVersion < 33}TStackAccess<T>(Self).{$IFEND}List[Count - indexFromTop - 1]; end;
  11. Stefan Glienke

    ANN: Open Source Event Bus NX Horizon

    Spring4D Events are just multicast events (like your regular OnClick but with possibly multiple handlers) - an event bus is more.
  12. Stefan Glienke

    IsZero or SameValue

    Upper and lower bound - look it up
  13. Stefan Glienke

    IsZero or SameValue

    Certainly not like that because this will not consider a value next to the potential find that is a closer match - when the list has a different count of elements the result could be different.
  14. Stefan Glienke

    Function with 2 return values ?

    And what exact benefit would a non-ref counted interface have? Once you pass down some you lose any control over its lifetime.
  15. Stefan Glienke

    Function with 2 return values ?

    With the current memory model that would be a complete disaster. The main appeal of using interfaces when doing some DI architecture is the ref counting. And the mantra "program to an interface, not an implementation" is factually wrong: read https://blog.ploeh.dk/2010/12/02/Interfacesarenotabstractions/
  16. Stefan Glienke

    Array size 64bits

    The difference in performance is clear - accessing a dynamic array which is a field inside the class is two indirections while accessing a static array which is a field inside the class is only one indirection. If you inspect the generated assembly code you will see that every access to the dynamic array has more instructions. This is the case every time you have repeated access to a field inside a method because the compiler does not store it away as if it was a local variable and then directly reads it but basically does Self.Table every time. For this exact reason I have explicitly written code that first reads the dynamic array into a local pointer variable (to avoid the extra reference counting) and then operate on that one via hardcast back to dynamic array (or via pointermath). That way the compiler could keep that in a register and directly index into it rather than dereferencing Self every time to read that dynamic array. To try out, add this code to your Button1Click: {$POINTERMATH ON} Table: ^DWord; {$POINTERMATH OFF} begin SetLength(Self.Table, NbPrime); Table := @Self.Table[0]; Now the code accesses the local Table variable which most likely is stored in a register.
  17. Stefan Glienke

    A gem from the past (Goto)

    If you are using XE2 as in your profile you could be affected by this: https://quality.embarcadero.com/browse/RSP-27375 And as David mentions depending on what is inside the try the compiler easily throws any register usage overboard and operates via stack.
  18. Stefan Glienke

    Use of inline variables..

    https://quality.embarcadero.com/browse/RSP-23096
  19. That Poker Benchmark is completely pointless as it has almost zero memory allocations - the majority of CPU time is spent sorting cards and stuff.
  20. Stefan Glienke

    Implement logic in TListView

    I would probably design it like this (enabling and disabling the Checkboxes depending on RadioButton3 Checked)
  21. Stefan Glienke

    Implement logic in TListView

    Use the OnChanging event to allow or disallow selecting an item depending on the existing selection
  22. Stefan Glienke

    Delphifeeds.com??

    That is exactly what I respond when someone tells me that Embarcadero should integrate TestInsight or Spring. Parnassus plugins ...
  23. Stefan Glienke

    generics

    Doesn't that make it a container? 😜
  24. Stefan Glienke

    generics

    Think of collections as "algorithms and datatypes for any type" - then you know the use case of generics. For any algorithm and/or datatype that is not just specific for one exact type.
  25. Stefan Glienke

    The Delphi 11.2 release thread

    11.2 is a nightmare - prior to LSP the worst was that ctrl+click did not work. Now, most of the time nothing at all works because LSP dies all the time.
×