Jump to content

David Heffernan

Members
  • Content Count

    3710
  • Joined

  • Last visited

  • Days Won

    185

Posts posted by David Heffernan


  1. Definitely Windows 11 is better than Windows 10. Just nice incremental improvements. Every single time there's a new release of Windows people complain that it's worse. But who honestly wants to go back to 98 or XP? 


  2. 13 minutes ago, Vincent Parrett said:

    I'll let Stefan chime in on that 😉  

    I'm sure he'll get here at some point, but I've been chatting with him about this.... So yeah, his development stands on a threadpool. There's a lot of really interesting aspects to it too. Looking forward to the Amsterdam Delphi event where he can say more. 

    • Like 1

  3. 57 minutes ago, Vincent Parrett said:

    ping @Stefan Glienke - he has been working in this area with even better results!

    Hasn't Stefan been working on using multiple threads, whereas SIMD will be on a single thread so actually really powerful in its own domain 


  4. 25 minutes ago, Rollo62 said:

    That would mean, that this tool "compiles" the code and is able to calculate the contents of the variable "foo".

    This can be from millions of different complex calculations and sources and even user input.
    I doubt that such tool will exists, but perhaps a Pascal parser together with a Pascal scripter may be able to simulate the codeflow and catch this.

     

    Maybe its easier, if you replace/mock the Format() and try to catch or log this error before it is raised.

     

     

    No, I am just looking for a tool that detects non literal args by static analysis, which is what I wrote


  5. I've recently come across a defect in my code that looks like this:

     

    msg := Format('%s' + foo, [bar]);

    If foo contains any format placeholders, e.g. %s, %20, etc. then this will result in an exception being raised.

     

    It's a stupid mistake, but now I want to check my entire codebase to see we've done it elsewhere.

     

    Ideally I'd like a static tool that detects any call to Format or common equivalent like Exception.CreateFmt for which the format string is not a literal. I don't think FixInsight has such a warning.

     

    Does anybody know of such a tool?


  6. 3 hours ago, Mark NZ said:

    I agree, followed by LSP then the IDE - a huge FIXES focus based approach would be good for a few releases.

    It feels like most releases in the past 5-10 years have been "quality focused" releases. In other words, they are already doing this. How is it going? 


  7. Just now, Brandon Staggs said:

    Obviously I was referring to the 64-bit compiler that was added in 12.2 for the Enterprise level, not the 32-bit compiler that can target 64-bit builds that we have had all these years.

    Yes, silly me! Sorry. 


  8. 1 hour ago, Brandon Staggs said:

    It is a priori "OK" because they are a private company which can decide how to spend their R&D money and we are free agents that can decide whether or not to subscribe.

    Sure. I can choose not to be impressed. 

     

    1 hour ago, Brandon Staggs said:

     

    I also was pretty harsh on them for packing the 64-bit compiler as a top-tier option prior to this (unavailable to Pro level subscribers), 

    The Win64 bit compiler was available for pro from initial release, XE2


  9. 1 hour ago, ToddFrankson said:

    So you didn't, and therefore you don't know what they stated about  the 64bit IDE, yet you complain.....

    I mean, I did, and I read the what's new. As I said, I think it's pretty poor that they can release software that is so far from being functional. 


  10. On 3/13/2025 at 3:56 PM, Brandon Staggs said:

    To be fair, they are being very straightforward about it being a "version 1" release and it isn't even enabled by default.

     

    Well sure. But isn't this pretty lame? Who does version 1 releases that don't work? They might be upfront about all of its deficiencies, but good developers produce software that works. 

     

    We've all used VS and VSCode and PyCharm and so on, and they work and shine. And then 12 months passes, it's 2025, and Emba come out with 5000 bug fixes and a 64 bit IDE that doesn't work. 

    • Like 1

  11. 18 hours ago, Anders Melander said:

    Bike shedding

     

    For example like this:

    https://github.com/graphics32/graphics32/blob/b45d1108a8f57b66739731e952f81e2636c63abd/Source/GR32.ImageFormats.pas#L386

     

    Example of use:

    
    const
      FileSignaturePNG: AnsiString        = #$89#$50#$4e#$47#$0d#$0a#$1a#$0a;
      FileSignaturePNGMask: AnsiString    = #$ff#$ff#$ff#$ff#$ff#$ff#$ff#$ff;
    
    ...
    
    function TImageFormatAdapterPNG.CanLoadFromStream(AStream: TStream): boolean;
    begin
      Result := CheckFileSignature(AStream, FileSignaturePNG, FileSignaturePNGMask);
    end;

     

    Sure, that basic concept. But I think I'd take it further and move the data into a text file embedded as a resource. Given the scope of this unit.


  12. This code would be much better if each check of file header was done with same same code, against a signature declared either in a constant, or maybe in a file that was linked as a resource. This would make the code much cleaner, without so much repetition, and would allow you to extend it very easily. 

    • Like 3
    • Sad 1

  13. As a broad rule, you should never call ShellExecute. It's long since been replaced by ShellExecuteEx. The only reason you need to know why, is that ShellExecute doesn't report errors correctly. ShellExecuteEx does.

     

    And in this case, as in so many cases, as Remy already pointed out, CreateProcess is correct. Whenever you are creating a new process, you use CreateProcess and not ShellExecuteEx. The latter is for executing shell verbs.


  14. 4 hours ago, Darian Miller said:

    One step further... I worked with a Delphi developer who rarely used Free, and tried to only use Destroy.  Everyone seems to have an opinion on Free vs FreeAndNil but he was the only one that ever went further and said Destroy vs Free.  Some of the same arguments could be had for using Destroy vs Free.  (But I still use .Free)

    This one is easy to debunk. Exceptions raised in a constructor then lead to exceptions in the destructor. This is the entire reason why Free exists. 

    • Like 2

  15. I get all the arguments that using FAN in a destructor is pointless, because how can you using that reference beyond the destructor. And I understand the argument for using it in a reference for an object that exists optionally, and can be destroyed outside of the destructor.

     

    What I don't get is what the downsides of using FAN are. What are the drawbacks? 


  16. 1 hour ago, Rollo62 said:

    Ok, I'm open for your proposals :classic_biggrin:

    If you got very sporadic AV on some customers devices and you are not able to reproduce that or to find any hints ....

    Sometimes a fast solution is needed, when a complete rewrite is currently not possible in time and you're unsure about the root cause.

    Of course I like to solve things once and forever too, and I only try to find possible use cases for the FreeandNil, which I have seen before.

     

     

     

    Simple. Understand the problem, and write your code so that it works 100% of the time.

     

    It's one thing that you aren't able to do so. That's your problem. But to come on a site like this and recommend that others work like this is wild. How about you retract this terrible advice?

×