Jump to content

Stefan Glienke

Members
  • Content Count

    1365
  • Joined

  • Last visited

  • Days Won

    130

Posts posted by Stefan Glienke


  1. 14 hours ago, Anders Melander said:
    • The filter problem turned out to be a copy/paste problem.
      Allen had copied his map2pdb parameter list from a post here, and somewhere along the way, two invisible zero-width no-break space characters (#$F0FF) got inserted into the string he pasted. So what looked like '-include:0001' was actually '-include:000'#$F0FF#$F0FF'1'.
      I've been bitten by that one myself a few times when I've copied code from a browser.

    I reported that issue years ago but unfortunately it still exists - the report contains the exact steps that lead to this at the end and thus might help to avoid it in the future:

     

    • Like 1

  2. fwiw all parameters but passing the mapfile name (since the exe name is most likely the same and directly next to it) and the -bind parameter (which causes the PE header in the binary to be updated in order for VTune to properly use the pdb) are optional.

     

    3 hours ago, chkaufmann said:

    Where can I find a good tutorial for VTune in order to get the info I used before with AQTime?

    VTune has some very extensive documentation and even a tour inside the application that teaches the basics


  3. Not so fast - it more likely was some AI that learned it from those sources - soon all loops will be written that way!

    5 minutes ago, dummzeuch said:

    So, why is that a problem? Is the code wrong? Or is it just not the way you would have written it?

    The problem is that apparently whoever implemented it that way in the VCL did not even care to apply their style guide to the code.

     

    And I am not even going into the legal ramifications of Embarcadero copying code from the internet and then putting it under their copyright.

    • Haha 1

  4. 4 hours ago, FabDev said:

    Yes my project (> 8 millions of line code) use not far than 40 components libraries like Devexpress (90 % of them component), TMS VCL, IBDAC, Fastreport, Teechart, HTMLEditor, Scalabium, JEDI, Indy, ICS, ImageEN, Jam Software, HTML Editor etc... All components are always up to date to "limit" bug.

    PS : I can have same kind of memory using when press F1 on a word.

    Could it be that you have some active database connection and live data? That contributes to the memory consumption of the bds.exe process.

     

    Edit: Also FWIW the memory shown in the TaskManager is the memory consumed for that process and all its sub-processes - click the expand button and you will see. I assume that there will be several LSP Server processes consuming quite some memory.


  5. 2 hours ago, Anders Melander said:

    how does one differentiate between preserve or trim leading white space and preserve or ignore newline?

    The closing quotes dictate the alignment, lines inside the string thus cannot be more left than the closing quotes, the last line does not have a trailing line break, if you want a trailing line break, add an empty line

    • Like 1
    • Thanks 1

  6. 1 hour ago, Fr0sT.Brutal said:

    Yeah, nice, they did it right. I think every lib dev should do the same, and probably shrink some older packages like f.i. "XE2-XE8"

    As one of the few lib devs that actually test their code on all supported Delphi versions I object - dproj files so often have incompatibilities in them.

    Yes, it is possible to have only multiple dproj files but only one dpk they refer to and put the libsuffix stuff into an inc file referencing that one on the dpr (have done that, works fine) but it is tedious.

    I rather copy the latest version when a new one comes out/is in beta.

     

    The more important thing imo is using forward-compatible defines in the code - it drives me mad whenever I compile some code in a newer version and it simply does not work because the code requires explicit defines because they are not done in a forward-compatible way.

    • Like 6

  7. 26 minutes ago, Uwe Raabe said:

    Could it be that using the equality operator qualifies for calling any method?

    If you are referring to TGUID specifically then I would assume that to be the case as that is basically what happens because it has operator overloading.

     

    To be more precise though because my previous comment might be misleading:

    - currently, we don't get any W1036 on using a field on some local record variable (see Test4)

    - we get a W1036 on local intrinsic non-managed type variables such as Integer (see Test1)

    - we *don't* get a W1036 on local intrinsic non-managed type variables such as Integer when they get passed by ref (see Test2) or a helper method is being called on them (see Test3) anywhere in the routine.

     

    type
      TIntHelper = record helper for Integer
        procedure Foo;
      end;
    
    procedure TIntHelper.Foo;
    begin
    end;
    
    procedure PassRef(var ref);
    begin
    end;
    
    procedure Test1;
    var
      i: Integer;
    begin
      if i = 0 then Writeln;
    end;
    
    procedure Test2;
    var
      i: Integer;
    begin
      if i = 0 then Writeln;
      PassRef(i);
    end;
    
    procedure Test3;
    var
      i: Integer;
    begin
      if i = 0 then Writeln;
      i.Foo;
    end;
    
    procedure Test4;
    var
      g: TGUID;
    begin
      if g.D1 = 0 then Writeln;
    end;
    
    end.

    My point is - yes I can craft some version of Test4 where something might happen with g that causes it to be initialized or not - but the point is: if I access any field on it *before* that it is a hundred percent certain that I am accessing an uninitialized field.

    Now in practice the compiler source code and its design might be in a state where doing this is hard to achieve but the point is: it's not impossible.


  8. We already have the situation that calling any method on a record disables the warning - I did not mention disabling that behavior, did I?

    Also, don't you think a compiler could easily see if the access to a field happens before or after some method call?

    I explicitly stated that there would still be cases where a W1036 would be appropriate but would not be seen due to some reasons but in the places where it is hundred percent certain that the access is to an uninitialized field the compiler should raise it

    • Like 1

  9. The explanation was given by the pm and not some compiler dev fwiw and it is nonsense tbh.

    The compiler already knows if a record is managed or not because if its managed then it inserts code to call to System._InitializeRecord.

    Now the case can happen that you access some field on a record that is a managed record but that field is of a non managed type - these fields are not touched inside that routine.

    The compiler can still issue a W1036 when accessing a field on a record that is not managed - would there still be cases where a warning would be missing? Yes, but it would be better than it is currently.

    • Like 2

  10. https://bitbucket.org/sglienke/spring4d/branch/feature/coroutines - the reasons it never made it into the main branch are what has been mentioned before and the fact that on POSIX I emulate them using a thread and an event (which is deadly slow) - still until anyone convinces me otherwise (by showing some actual working code!) this is the closest we get to some conveniently usable coroutines in Delphi.

    • Like 1

  11. I am not sure what y'all discussing here but the snippet that Tommi posted is about checking the first character before even calling strncmp (video at around 15:15).

    It's pretty obvious why that is faster - if the characters don't match you get rid of the function call.

     

    The algo does not need to restrict anything - the hashtable contains all keywords and the input is any string that occurs in the source code - if it's a keyword, it gets found, if it's not, then it won't be found, simple as that.

    • Like 2

  12. On 32bit the compiler keeps the value of the multiplication in the FPU to pass it to Round (which takes its parameter as Extended), on 64bit the precision of Extended is the same as Double.

    You get the same result on 32bit if you store the result of the multiplication into a double variable and then pass that one to round.

    • Like 2

  13. 16 minutes ago, Cristian Peța said:

    It is because calling convention Right-to-left parameter order?

    No, because there are no parameters on ReadChar.

    No, because even if you mean the string concat method (which is UStrCat3 that will be called here) you will see that if you call ReadChar a third time suddenly order is correct (which then calls UStrCatN)

    No, because even parameter passing order is undefined behavior in Delphi

    • Thanks 1
×