Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. David Heffernan

    Using uninitialized object works on Win32, throws AV on Win64

    I understand all of that, hence my first post. I explained why Delphi behaves the way it does, because var is both in/out and out.
  2. David Heffernan

    Using uninitialized object works on Win32, throws AV on Win64

    In C# you can't pass an uninitialized variable to a ref param, but you can to an out param.
  3. David Heffernan

    Using uninitialized object works on Win32, throws AV on Win64

    I think this is because Delphi doesn't really distinguish between in/out and out semantics. Since it doesn't know whether var implies in/out or out, it can't warn, because the var parameter may be an out parameter. And yes I know that the out keyword exists but certainly for value types it is purely cosmetic. Contrast this with the clarity of C#.
  4. David Heffernan

    Using uninitialized object works on Win32, throws AV on Win64

    Completely wrong. And rather unhelpfully so.
  5. David Heffernan

    Using uninitialized object works on Win32, throws AV on Win64

    You weren't lucky. You were unlucky. Lucky would have been if the error had shown itself immediately. No point analysing luck. Fix your code and move on.
  6. David Heffernan

    Is Graphics32 ready for Delphi 11 yet?

    @Borut please don't spam the same post. Especially not by adding to the end of another old post.
  7. David Heffernan

    List index out of bounds(1)

    sList[1] is likely the issue because sList contains 1 or fewer items. Use the debugger to confirm. Those calls to ProcessMessages look likely to cause you problems. If.not now, some time in the future.
  8. David Heffernan

    Tries to convert from D7 to D10

    There are likely to be other errors in such a migration. It pays to understand.
  9. If FPC had given 9 that wouldn't have changed the conclusion
  10. I never said anything about this specific case. I am referring to universal rules that can be applied, or in this case not because they don't exist. See the black and white cow argument.
  11. That just tells you about this one piece of code and whichever compilers you happened to use. It doesn't prove a rule. If you look in a field and see that all the cows in that field are back and white, does that prove that all cows are black and white?
  12. This code exhibits undefined behaviour. In an expression like a + b, a and b can be evaluated in either order. The language does not mandate that order. If you want to make your code well defined the. You need to evaluate the function on one statement, and then perform the addition in another. finalValue := ResultIsFive(index); Inc(finalValue, index);
  13. No I don't think that is true.
  14. David Heffernan

    Profiler for Delphi

    AMD have their own tool I think. No idea how good it is.
  15. David Heffernan

    Tries to convert from D7 to D10

    This is all about the Unicode changes introduced 12 years ago in Delphi 2009. There are hundreds of posts about this. You aren't going to master this in minutes and with quick post here. You'll need to research this in depth. Start with Marco Cantù's Unicode whitepaper.
  16. 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.
  17. 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.
  18. David Heffernan

    Profiler for Delphi

    It extremely hard to see past vtune
  19. Oh for a library writer then yes, the calculations are different and there is much more justification for this
  20. Because it clutters the code and you can find such bugs other ways which don't clutter the code.
  21. 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.
  22. 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.
  23. You described the correct construction pattern as a "problem" which is what confused me.
  24. 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.
  25. 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.
×