Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. David Heffernan

    One more memory leak and FastMM4

    All this speculation..... A minimal example and the answer would be simple.
  2. David Heffernan

    Load form icon while using styles

    I also talked about such examples. This isn't one of them. You said, "I'd understand if the logic was implemented in RecreateWnd but that's not the case here". You literally talk about making a choice based on the implementation details. I still can't see why you are set against calling RecreateWnd. That seems perverse to me.
  3. David Heffernan

    Load form icon while using styles

    Not so. For sure the language doesn't stop you using any message you like. But that doesn't mean that it is reasonable to do so. Oftentimes messages are used in the private implementation detail for a class. As a broad principle, you should not be looking to work with Windows messages when consuming VCL controls. Sometimes one is forced into it because the control provides no official mechanism. But when we do that, it is brittle, and subject to future implementation detail changes. And there it is. There's the point where you take a dependency on on implementation details. The implementation of RecreateWnd is: procedure TWinControl.RecreateWnd; begin if WindowHandle <> 0 then Perform(CM_RECREATEWND, 0, 0); end; There is a difference between this code and yours. Your code does something unconditionally. But RecreateWnd does nothing if the window handle has not already been created. I'm quite sure that you've got this wrong. I mean, it won't have any material impact on things, but one may as well do things the right way.
  4. David Heffernan

    Load form icon while using styles

    This doesn't make sense to me. I don't see the argument for sending a private implementation specific message rather than calling the RecreateWnd method.
  5. David Heffernan

    One more memory leak and FastMM4

    Dude, just make a minimal example and debug that. Post it here if you want. Really good discipline to learn how to make that minimal example.
  6. David Heffernan

    One more memory leak and FastMM4

    Cut this code down to the minimum that leaks. Then debug that.
  7. David Heffernan

    One more memory leak and FastMM4

    Try finslly still wrong. You must acquire the resource immediately before the try Foo := TMyObject.Create; try Foo.Use; finally Foo.Free; end; As you have it, if an exception is raised before the variable is assigned, you'll call Free on an uninitialized variable.
  8. David Heffernan

    One more memory leak and FastMM4

    Not the cause of the leak, but each of those calls to TSomeObject.Create needs to be protected in a try/finally
  9. David Heffernan

    Again with memory leaks and FastMM4

    Free is implemented as if Assigned(Foo) then Foo.Destroy; so those if statements in the previous post are pointless. Call Free unconditionally.
  10. David Heffernan

    SynEdit preferred version?

    Even harder than porting to delphi.
  11. No. It's clear. He wants the address of the record stored internally by the class to avoid a copy.
  12. What value of xxx is to be used?
  13. "may" is rather weak. A more detailed clarification may be useful to the asker, to make it clear that the code you offered does not prevent a copy, and in fact just adds obfuscation. However, it's also possible that there is premature optimisation going on here.
  14. Surely that's just going to copy the record to a temp local, and return the address of that temp local. Or am I missing something?
  15. Then you end up with different names for the same thing. How can that be better? Refactoring tools get these names changed very reliably. I don't understand why people are scared of changing names. If you aren't prepared to change names then your code will be a mess.
  16. Now you have the type named incorrectly in thousands of places. It should be called TItemExArray. Seems far worse to me.
  17. I can't really see any benefit here. I mean you might think that TItemArray is somehow better than TArray<TItem> but they seem pretty interchangeable to me in terms of readability. And the reader has to trust that convention was followed with TItemArray.
  18. David Heffernan

    Class Constructor in Delphi 10.4

    No. It is deterministic.
  19. Those are two completely different things. One is a generic dynamic array type, the other is a generic method.
  20. You are just polluting the namespace for no benefit. Use TArray<T>.
  21. David Heffernan

    Class Constructor in Delphi 10.4

    D is a truly wonderful language, and Andrei Alexandrescu's book is by some distance the best programming book I have ever read.
  22. David Heffernan

    RTTI in dpr / console app dpr

    Basically this then?
  23. David Heffernan

    RTTI in dpr / console app dpr

    So, is it the case that rtti is generated for types declared in the project file, but these rtti types don't have a qualified name?
  24. David Heffernan

    RTTI in dpr / console app dpr

    I don't think about you at all. I was interested in the question. Try to view comments as impersonal. That's entirely possible. I'm interested in learning. It's possible that my misunderstanding is because of imprecise statements. It's possible I'm slow on the uptake. To be clear, I thought you said that types declared in the project file had no RTTI. I checked that and was able to retrieve RTTI for such types. I simply don't understand the strength of your reaction.
  25. David Heffernan

    RTTI in dpr / console app dpr

    My post above demonstrates that RTTI does exist. I think that the real issue is that these types don't have qualified names.
×