Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. David Heffernan

    Typed constants in Delphi.

    The fact that you've never come across a need for taking the address of a constant doesn't mean the need doesn't exist. How about asking why this need arises rather than thinking you've seen all possible use cases for typed constants.
  2. David Heffernan

    Typed constants in Delphi.

    I didn't see the part where you measured compile times. It is true. We're talking about Delphi. We're not talking about some potential other language.
  3. David Heffernan

    Typed constants in Delphi.

    Conclusions seem bogus to me. I don't think the compilation speed is a factor, and there are plenty of times when you use typed constants for integers. The rules really should be: 1. Use true constants if possible. 2. Otherwise use a typed constant. The factors that force you to use typed constants are broadly because the type is a complex type which doesn't permit true constants. Or you need to take the address of the constant.
  4. David Heffernan

    SendMessage From DLL

    Wait a minute. If its a 64 bit add in then why are you casting the pointer to a 32 bit integer?
  5. David Heffernan

    SendMessage From DLL

    I highly doubt that wordID or hdl are really THandle. The latter should be HWND. Not sure what the former should be. THandle represents a kernel handle. It's something that you would call CloseHandle on. As for your problem, hard to know. Could be UIPI. You don't do any error checking when you call SendMessage. You need to add some trace debugging.
  6. David Heffernan

    Byte and Integer

    Couldn't take the traffic of tens of devs trying to vote for range checking enabled by default
  7. David Heffernan

    Strange behavior for literals

    Let's start by establishing whether or not there is a problem that cannot be worked around. Which integer value are you unable to declare as a literal?
  8. David Heffernan

    Strange behavior for literals

    I have a question for you. Which integer value are you unable to declare as a literal?
  9. David Heffernan

    Strange behavior for literals

    It's more nuanced. Assign it to a single variable, and it's just a 4 byte assignment. At least that's how it always has been for floating point literals. Its type is only really crystallised then you assign it is how you might think about it.
  10. David Heffernan

    Strange behavior for literals

    FWIW, const C = Single(0.1) does not compile in XE7 which is my day to day Delphi. And it does in 10.3 and possibly earlier versions too. Which would appear to provide a way to specify the type of floating point literal when the value is not exactly representable. I'd prefer to use a suffix rather than a type, but the precedent was set by integer types. So, no, I don't see any unsurmountable problems here.
  11. David Heffernan

    Strange behavior for literals

    I don't think the issue is that I don't see the full picture and have a lack of clarity.
  12. David Heffernan

    Strange behavior for literals

    As far as I am concerned the only issue raised in this thread that can't be worked around is the type of floating point literals. Integer literals can be cast. But not floating point literals. Having said that, my recollection is that `Single(0.1)` would not compile so I wonder if there has been a change since XE7, the version I am most familiar with.
  13. David Heffernan

    Strange behavior for literals

    The inability to control the type of a floating point literal is the only real issue here. Everything else mentioned above can be readily worked around. But the fact that you can't control the type of a floating point literal presents problems that have no workaround. I want to write const s = 0.1s; d = 0.1d; And have two literals with different values.
  14. David Heffernan

    Byte and Integer

    They should be, don't know why Emba doesn't do this
  15. David Heffernan

    Byte and Integer

    You should enable both range checking and overflow checking. Then you'll see your exceptions.
  16. David Heffernan

    Crash when Delphi 10.n exits... again

    The actual bug could be in eithsr of these plugins, or another plugin, or the IDE itself.
  17. David Heffernan

    DeleteFile Compilation Message

    Curious, but why would here be VCL and FMX versions of Delete File? Isn't it an RTL function?
  18. David Heffernan

    Revisiting TThreadedQueue and TMonitor

    If it failed in a virtual environment, then the code is presumably defective
  19. David Heffernan

    ICS v8.64 can't compile on Delphi 7

    I have a case in my test suite that checks compilation for all supported delphi versions of all code that I ship to clients. Pretty easy to set up.
  20. David Heffernan

    TStopwatch.Elapsed

    I think it is often the case that documentation for Delphi is added sometime after the code is released. Documentation for mature parts of the libs is often reasonable. Not so much for newly released libs. I think this is a really poor way to develop libs though. I routinely find design issues when I am writing documentation. If you write the documentation after you release then you'll find those issues after the consumers have started using the libs.
  21. David Heffernan

    TStopwatch.Elapsed

    I don't think RTFM is the right way to say it. But I trust you make a mental note to check the documentation another time. I mean, the way the message was delivered was clumsy, but the thrust of the message is valid.
  22. David Heffernan

    TStopwatch.Elapsed

    is all you need
  23. David Heffernan

    TStringGrid Sorting

    OK, I was sloppy. I still don't get why you wrote this sorting function rather than use built in algos.
  24. David Heffernan

    TStringGrid Sorting

    Writing a sorting algorithm into a UI control is a bad idea. Keep the two separate. You'd only really need to use merge sort if you needed a stable sort. And then you'd have to take care that the merge sort algo was a stable one. Surely there is perfectly usable built in sorting code?
  25. David Heffernan

    Embarcadero entries in the path

    I remove them all. I don't have any problems. It means I can use any of the many versions I have installed easily. For versioned packages, e.g. vcl270.bpl then multiple entries are fine. But for non versioned tools, e.g. dcc32.exe then it's a mess. These days it just feels a bit weak to rely on the path to find libraries. I always place them in the executable directory, or in sub directories and use SxS assemblies. I remove all entries and then my build scripts set up the appropriate environment for the target version, and then call msbuild. Works for me but I'm sure there are other ways.
×