Jump to content

David Heffernan

Members
  • Content Count

    3494
  • Joined

  • Last visited

  • Days Won

    172

Everything posted by David Heffernan

  1. David Heffernan

    Profiler for Delphi

    I'm using the latest vtune and didn't need to do anything with msdia140 and it all works perfectly.
  2. David Heffernan

    Profiler for Delphi

    No, it performs really well for me. Are you using the latest version? It loads quickly for me and does a good job of taking me to the parts of the code where the time is being spent.
  3. David Heffernan

    Profiler for Delphi

    It extremely hard to see past vtune
  4. Oh for a library writer then yes, the calculations are different and there is much more justification for this
  5. Because it clutters the code and you can find such bugs other ways which don't clutter the code.
  6. I don't really see the value of this, if the input is contracted to be assigned. That makes it a programming error, your tests will AV and you will fix it. No need to clutter the code with if not Assigned tests.
  7. The whole point of exceptions is that in a huge number of cases it is impossible to "deal with it" at the point where the error is raised. The code has been called by another function that excepts it to succeed. If it can fail, but return normally without an exception bubbling up, then you need to return information to the caller that the function has failed. And the caller may in turn be have its own caller that needs to know this. And we are right back to exception free code where errors are indicated by boolean or integer error code return values. Exceptions that bubble up the stack are only difficult to manage if you don't write your exception raising and handling code properly. For sure it is perfectly possible to write crappy exception code. But you are pointing the finger in the wrong place.
  8. You described the correct construction pattern as a "problem" which is what confused me.
  9. Don't you know that exceptions bubble up the call stack? If you try to handle them immediately then you've just got crappy error code type code. The entire point of exceptions is that you don't need to deal with them at the point where the error occurs.
  10. No. The try finally here protects the lifetime management of the instantiated object, after the constructor has completed. An exception in the constructor will bubble up from here and never enter the try. This is a very very common misunderstanding.
  11. No. Its pointless trying to handle exceptions in destructors. If that happens the process should terminate.
  12. Again, can somebody explain what problem is caused by raising in a constructor. We all seem fine with TFileStream doing this, so all I can see is dogma.
  13. I don't see the point of trying not to raise in a constructor as a design goal. Raise the exception at the point where you know it needs to be raised.
  14. What do you think about TFileStream.Create raising an exception if the file can be opened in the requested mode for whatever reason? I cannot see the problem with this, or indeed any constructor raising. If you are going to admit exceptions in your program at all, you must be resilient to them. Why is it any different to get the exception raised in a constructor than anywhere else.
  15. The advantage of moving that teardown call to the subject's destructor is that you don't need to test Assigned. If it raises an exception then you are still hosed.
  16. In a destructor you do need to test Assigned on members if you call any method other than Free. That said, destructor must not raise exceptions. And its generally better to move the call to those teardown methods into the destructor of the class.
  17. This is pertinent to some of the discussion here: https://stackoverflow.com/a/8550628/505088
  18. I mean if you have a bunch of files that need to transformed once, then writing delphi code isn't the most efficient. You'd just use a scripting language to make the change and throw the code away. But if you have a Delphi product that needs to repeatedly perform this transformation then that's not going to be useful.
  19. If this is a one time transformation then it's easier with a scripting language
  20. This is just going to be the age old issue that most Windows code expects floating point exceptions to be masked, and Delphi's RTL unmasks them. So, mask floating point exceptions when you call into Python, and unmask them when the Python call returns. Or just mask them always if you don't care about floating point exceptions. Of course, the floating point support for changing floating point control state is not thread safe in the Delphi RTL as I have been saying for more than a decade now.
  21. David Heffernan

    calculete time in delphi

    It still doesn't make any sense to me why you wouldn't just use TStopwatch.
  22. David Heffernan

    calculete time in delphi

    No idea why you wouldn't use TStopwatch
  23. David Heffernan

    stringreplace character in all string

    I'm sure your function would give the same result. Did you read the earlier posts? They explain what is going on.
  24. David Heffernan

    stringreplace character in all string

    Why is that better than StringReplace? How does it relate to the problem in this thread?
  25. David Heffernan

    Move a Function or Procedure to a Unit??

    Get Martin Fowler's book on refactoring.
×