Jump to content

David Heffernan

Members
  • Content Count

    3710
  • Joined

  • Last visited

  • Days Won

    185

Everything posted by David Heffernan

  1. Yes but it's hard to see the relevance. Representable numbers have the form k*2^n. Perhaps you don't actually need exact representability. We don't know what your requirements are.
  2. David Heffernan

    C# struct to Delphi conversion help

    Of course the other problem with packing a record that should be aligned is that gives it alignment of 1 so they can be misaligned. These days that doesn't usually matter for x86/x64 but it can be a issue for some SSE2 instructions and for arm processors.
  3. Even rational numbers aren't exactly representable. Examples include 1/3 and 1/10.
  4. You mean the request to store pi exactly in a float ?
  5. David Heffernan

    C# struct to Delphi conversion help

    Hard to comment on this without seeing you actual code. This is all about the detail and we have none of it. For all I know you are using packed records and manually inserting padding. In which case, if that's what you've decided to do then you know how to fix it.
  6. David Heffernan

    C# struct to Delphi conversion help

    It would have been useful to say something like this, like you may need manual alignment if you need to use ancient compilers like Delphi 6. But even then, in most cases, aligned records work as expected. It's only in some very rare cases that this is not the case. Perhaps you have an example for us. Or has that knowledge been lost in the passage of time. For people that don't need to support 20 year old compilers, feel free to use the compiler to do the alignment.
  7. David Heffernan

    C# struct to Delphi conversion help

    Show us an example, with modern Delphi. For sure some ancient versions didn't get alignment correct. That's no longer the case. Compiler alignment always works for me, and I do a lot of it. And converting to 64 bit was trivial when I had to do that.
  8. David Heffernan

    C# struct to Delphi conversion help

    In your Delphi code you should be using {$MINENUMSIZE 4} at the point where you define the enums. An example from my own codebase: //Dragon4 {$MINENUMSIZE 4} type TDragon4DigitMode = (DigitMode_Unique, DigitMode_Exact); TDragon4CutoffMode = (CutoffMode_TotalLength, CutoffMode_FractionLength); {$MINENUMSIZE 1} I would however say that using offset methods to compare offsets is very good advice. But I definitely do not advise manual alignment. The compiler can do it perfectly well. You may as well get it to do that. Then, come the day you move to 64 bit, you won't have to change a thing.
  9. David Heffernan

    C# struct to Delphi conversion help

    This is bad advice. If you are using aligned records in Delphi, then the compiler uses the same alignment rules as for aligned C++ structs, and for aligned C# structs.
  10. The things you are discussing now seem unrelated to storing pi in a float. I don't feel as though we understand the problem domain yet.
  11. You can't store pi exactly in a float. What is the motivation for the question?
  12. David Heffernan

    Impossible to find error

    A dfm file is a source file
  13. David Heffernan

    Impossible to find error

    Definitely not impossible to find the error. Search for TDBLookupComboBox in all the .dfm and .pas files that are compiled.
  14. This isn't true. Your class function calls the default constructor and that performs memory allocation. Free must be called. Instances of classes are heap allocated.
  15. David Heffernan

    Please need help for some java lines program to Delphi

    What have you tried so far?
  16. David Heffernan

    Please need help for some java lines program to Delphi

    What specifically do you mean by "help me translate"
  17. David Heffernan

    Remote Delphi developer position

    6 month contract and you have to jump through all these hoops. It's a seller's market right now.
  18. David Heffernan

    Remote Delphi developer position

    Staggering that an employer could post something as demeaning as this.
  19. David Heffernan

    Unable to run 2 TPythonEngine per VCL application

    Next release of Python supports per interpreter GIL which sounds exciting.
  20. David Heffernan

    FileOpen a network file

    Well, there will be an error code. You have to retrieve it.
  21. David Heffernan

    FileOpen a network file

    When you tried this, what happened? What error was reported. Or was there no error reported?
  22. David Heffernan

    FileOpen a network file

  23. David Heffernan

    New Code Signing Certificate Recommendations

    This is precisely what I am doing. My Python build code to perform signing starts like this: def Sign(filename, sdk=None): # see https://medium.com/@joshualipson/ev-code-certificates-automated-builds-for-windows-6100fb8e8be6
  24. David Heffernan

    FileOpen a network file

    It doesn't look like that to me. It looks like a file read for a file named by UNC. I don't think I'd be wanting to use FileOpen anywhere ever. Shouldn't you be using streams these days? Having said that of course, FileOpen still works. You didn't tell us what happened when you used the old code. If you have a problem that you want some help with, then you should say what the problem is. People can't offer solutions to problems that aren't described. Do you understand what \\IP_address\FolderName\Filename is? I trust you do, and that the file specified by this UNC path is available on your current target device. Is it?
×