Jump to content

A.M. Hoornweg

Members
  • Content Count

    473
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by A.M. Hoornweg

  1. I don't mean to compare Pascal to C. I just mean that Delphi has become less usable for low-level modular stuff because the executable size has become so big. Delphi 2009 was the last compiler that created really compact executables.
  2. If Microsoft used Delphi, Windows would be a petabyte in size.
  3. If many units are significantly smaller, it could indicate less inlining, less RTTI overhead, or a much more clever compiler (which would be a sensation). It would be interesting to do a few benchmarks and compare some generated assembly code.
  4. I have no idea, it could be a lot of things. Maybe there's less inlining? Or are they finally using a more compact format for RTTI info? Or maybe LLVM is involved now? Whatever it is, I find the reduction in executable size impressive (I'm a sucker for efficiency). I would be interested to know if x86 code has become tighter also?
  5. A.M. Hoornweg

    How to use unit BufferedFileStream & FastCopy?

    A broken drive is much more costly than the price of the hardware alone. Hard drives *will* fail sooner or later. I have had at least 8 hdd's fail on me in my career. Drop a HDD hard and it's probably ruined (at least I wouldn't ever trust it anymore). If you order a HDD, you have no way of knowing if it was dropped or half frozen during shipping. SSD's OTOH are very insensitive to shocks and temperature differences. No moving parts!
  6. A.M. Hoornweg

    How to use unit BufferedFileStream & FastCopy?

    David asked "What's wrong with". So I pointed out some. OP may have other reasons, admittedly. 🙂
  7. A.M. Hoornweg

    How to use unit BufferedFileStream & FastCopy?

    I avoid it for the following reasons. First of all, the CopyFileEx API documentation does not specify if the source file is opened for shared access or not. So I don't know how it behaves when multiple users are accessing the file and if that behavior may change in future. Secondly, when I copy a file somewhere, I emphatically want it to inherit the access properties of the target directory. Otherwise the access rights become unpredictable. Unfortunately, the CopyFileEx API documentation says "The security resource properties (ATTRIBUTE_SECURITY_INFORMATION) for the existing file are copied to the new file". I really don't want that to happen.
  8. A.M. Hoornweg

    What is this syntax?

    Hello all, I recently stumbled upon some code whose syntax was new to me. That doesn't happen too often so I'm slightly overwhelmed. How do you call this elegant way of declaring constants, and is it documented somewhere? I especially like the implicit association between a type and values. Type tSomeType=( begindoc=$01, Newpage=$02, enddoc=$03 );
  9. A.M. Hoornweg

    What is this syntax?

    I just tried if succ() and pred() work correctly with eplicit ordinal values if there are gaps between the numbers. They don't. Too bad, it would have been totally cool.
  10. A.M. Hoornweg

    What is this syntax?

    I very often have the case that I need to parse records in files and data streams where some integer field identifies the type of content that follows. Some of them were generated by software of my own, some by others. So for that, it is eminently useful: Instead of declaring tons of constants with prefixes to clarify the context they apply to, one just declares an enum which locks the constants into a common namespace. For example, look at what Borland did a long time ago in units System.pas and Variants.pas. It's full of prefixed constants like VarEmpty, VarNull, VarInteger .... where a single enum type tVariantType= (Empty=0, Null=1, ...) would have been much prettier. This example comes to mind because I need to decode and encode variants quite often.
  11. A.M. Hoornweg

    What is this syntax?

    Thank you! So if I understand correctly, it's just an enum with explicitly defined integer values instead of the default 0...X sequence that the compiler would otherwise generate. Too bad, my first impression was that the constants had an implicit associated data type (integer) and that I could use it for stuff like Type tnumerals=( one='uno', two='due') but that clearly isn't the case. Too bad. But still, I think the syntax is very handy for some of my purposes.
  12. A.M. Hoornweg

    Convert Double to Real

    I believe the old Turbo Pascal "Real" type is now called Real48 and exists only for compatibility purposes (i.e. if you need to read or write files with data in that format). It is much slower than either Double or Single because it's not a native FPU format.
  13. BTW, the "classical" method to detect or prohibit more than one instance of an application is to use a mutex.
  14. Hello all, one of my (heavily multithreaded) Windows services crashed today with an access violation and Windows was decent enough to write the "fault offset" in the event log. I have a detailed linker MAP file of the application. Does anyone know a tool that will parse the MAP file to help me find the approximate error location in the source?
  15. A.M. Hoornweg

    VMWare Workstation PRO vs MS Hyper-V

    Another advantage of VMs is that you're able to do remote debugging and test your software on a different version of Windows than the one you're developing under. I can easily compile a Delphi application on my Windows 10 development VM, deploy it to a network share on my Windows 7 VM and debug it on that operating system. Piece of cake. The same goes for Linux. It's even possible to run MacOS under VMWare, though Apple doesn't allow it unless the underlying host is an Apple machine. The latest VMWare version can co-exist with Hyper-V on the same host machine by the way.
  16. A.M. Hoornweg

    VMWare Workstation PRO vs MS Hyper-V

    Some advantages of using virtualization: Backing up a vm is as easy as copying a file. If you break something in a vm, it doesn't affect the host machine. If you decide to replace your host machine with a new one, you're up and running again within an hour. I've configured my VM to use separate virtual disk files for C: and D: and I keep my projects on D:. Whenever I update Delphi, I archive the virtual C: drive first. This makes it dead easy to fire up an older Delphi version whenever I need it.
  17. A.M. Hoornweg

    VMWare Workstation PRO vs MS Hyper-V

    I'm using VMWare Workstation Professional since many years and totally love it. I have 2 external screens attached to my notebook (plus the internal one, which makes three) and I can very flexibly set VMWare to use any combination of screens and resolutions. This makes it very easy to test DPI-Aware applications. Another big advantage for my specific line of work is that VMWare lets me configure virtual COM Ports (which communicate with each other through named pipes) so I can test serial communication protocols even though my notebook has no "real" RS232 ports. VMWare also supports virtual networks so I can define "private" networks between virtual machines that are isolated from others. There are tons of ready-made VM's to download from the internet with appliances like routers etc. When configured right, a VM in VMware is not noticeably slower than the host machine.
  18. Hello all, I'm trying to debug a multithreaded application that contains, among other things, the Intraweb framework. I have the Parnassus Parallel debugger installed in my Delphi 10.4.2. Sydney IDE. My problem: whenever I try to set a breakpoint in a multithreaded piece of code of my own, the Delphi debugger immediately complains that it can't find the location of some Intraweb source file. Of course it doesn't, because Intraweb doesn't come with source, so why is it asking? The big problem is that this message is impossible to get rid of. It just keeps coming again and again and I never even get the change to assign the correct thread affinity to my breakpoint. So... How the heck do I tell the Delphi debugger to not keep asking where the Intraweb sources are located?
  19. A.M. Hoornweg

    Debugging problem (multithreaded & Intraweb)

    Unfortunately not, when I do that, the next dialog appears immediately for the next Intraweb unit (there are several hundred). Debugging is just not do-able as long as this dialog keeps popping up.
  20. A.M. Hoornweg

    Find exception location from MAP file?

    This is very interesting, I'll certainly look into this. I'm also currently evaluating Eurekalog.
  21. A.M. Hoornweg

    Find exception location from MAP file?

    Thanks to everybody who responded in this thread. I think I'll acquire Eurekalog or MadExcept for this project. Is any of these two particularly suited for multithreading NT services?
  22. A.M. Hoornweg

    Find exception location from MAP file?

    My service is heavily multi-threaded (see attachment) , has hundreds of threads running which pull data from a multitude of oil rigs. The communication threads use Remobjects Remoting which is also multithreaded. The service itself has a builtin http management console that is based on Intraweb, which is also a multithreaded framework. There is sooo much multithreading going on, can a tool like Eurekalog produce a stack frame if one of these threads produces an AV?
  23. I think it does. The two searches are not disjoint, so calling StringReplace (shortest word first) would replace "Hut" by "House" and the name "Hutt" would not exist anymore in the second search pass due to this insertion. An approach that starts by scanning the original string for all search terms would reveal two "hits" at the first letter H and then things get interesting, because it would have to decide which replacement is "better". So it needs some rules to make that decision. One rule could be to replace the longest search term.
  24. What I mean is, if you call Embarcadero's stringReplace routine multiple times, then each subsequent replace sees the insertions made by the previous call. But if you write a MultiStringReplace routine that first analyzes the string and determines everything that is to be replaced, that is not the case. It sees only the original string and not the intermediate insertions. The end result may be different.
  25. I am a bit puzzled here. How do you want to guarantee a consistent outcome? The first "search & replace" will change the string. It will remove characters and insert new ones. Which may get captured by the next search. Suppose you have a string like "Jabba the Hutt lived in a Hut" and you want to replace "Hutt" by "Alien" and "Hut" by "House". How do you decide which replacement to do first?
×