Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 07/01/20 in all areas

  1. Dalija Prasnikar

    FreeAndNil 10.4 vs 10.3.1 and Pointers

    Maybe you will find some answers here https://dalijap.blogspot.com/2020/06/magic-behind-freeandnil.html
  2. Stefan Glienke

    FreeAndNil 10.4 vs 10.3.1 and Pointers

    Refactoring away from objects to something else and forgetting FreeAndNil is probably the number one source of defects of this category which is why I am happy for this change in 10.4 even though it also has its quirks most notably an API that tells a lie.
  3. Either someone didn't understand FreeAndNil or the code used TObject in the first place and later changed to a typed pointer, but forgot to adjust the FreeAndNil call.
  4. Remy Lebeau

    FreeAndNil 10.4 vs 10.3.1 and Pointers

    Yes, actually it does. The thing on its left is the * token. It might help to visualize this if you add whitespace between the TObject and * tokens - the compiler will simply ignore that whitespace, but the tokens are still treated separate: void FreeAndNil(const TObject * const &Obj); So, the 1st const binds to the TObject type, and the 2nd const binds to the * pointer, so you end up with the Obj parameter being a reference to type "const pointer to const TObject".
  5. Would choose FreeNullminator, ... hasta la vista .... Object
  6. Mahdi Safsafi

    Regex Validate string

    There are many reasons : - This is a good place where using RegEx makes sense. - RegEx interacts perfectly with UDB. Eg: '^[\p{Arabic}\p{P}A-Za-z0-9\s]+$'. How someone can represent \p{P}, \p{Arabic} smoothly when doing hand-writing ? - In many times(but not always), RegEx can outperform a hand writing function specially if you compile them. I didn't test but I believe RegEx-solution performs better than your hand-writing-solution. - RegEx is much faster for typing and reading. - Extending a RegEx pattern is much simple than extending a function. - ... AFAIK, RegEx do not rely on OS. They have their own DB.
  7. Anders Melander

    Regex Validate string

    Why on earth are you using RegEx at all? Just use one of the many existing functions or bake your own: function ValidateChars(const Value, ValidChars: string): boolean; begin for var v in Value do begin var Valid: boolean := False; for var c in ValidChars do if (c = v) then begin Valid := True; break; end; if (not Valid) then Exit(False); end; Result := True; end; Also consider using character classes. See TCharHelper in the System.Character unit.
  8. aehimself

    Regex Validate string

    Ummm.... Why make a string? Why not getting rid of Allowed and setting Result directly? Why going through character by character if Regex can validate the whole string at once? If I'm not mistaken you'll achieve the same with this one line: Result := Regexs.IsMatch(svalue.Trim, '^[ء-يA-Za-z0-9$&+=?@#~<>.^*()%!\s]+$');
  9. Darian Miller

    ANN: StyleControls VCL v. 4.71 just released!

    It looks nice. Do you include any specific fixes for VCL Styling in 10.4?
  10. Dalija Prasnikar

    TButtonItem does not have a TAG property

    Just to make it clear, I am not dismissing using dictionary mapping where it fits better (if you don't have up front defined set of actions at call site), I am merely objecting to the notion that using integer tags is toy programming.
  11. For the complete removal of Rad Studio 10.4 the next time you can use this instruction. In this case, following the steps described in it, you can check if there are still any traces of Rad Studio 10.4 left after the standard removal. Also verify that you have no Rad Studio 21.0 directories in your Environment System Variables "Path"
  12. David Heffernan

    TButtonItem does not have a TAG property

    I'd far sooner use Sender in an event handler to identify the control, and then have a map to anything else. Tag falls over as soon as you need to handle more than a single aspect. Plus there is no type safety.
×