The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Damned ! var Comp : function(const s1, s2: string): Boolean; begin if CheckB…

Posted by jpluimers on 2018/01/10

One of my main gripes about lots of RTL/VCL/FMX code: conventions are often lacking.

Which means one of the below functions starts with Ansi (but does a Unicode operation) and the other has the parameters in reverse.

var 
  Comp: function(const s1, s2: string): Boolean;
  begin 
    if CheckBox1.Checked then 
      Comp := ContainsText 
    else 
      Comp := AnsiStartsText;
  end;

–jeroen

source: [WayBackDamned ! var Comp : function(const s1, s2: string): Boolean; begin if CheckB… – Paul TOTH +

2 Responses to “Damned ! var Comp : function(const s1, s2: string): Boolean; begin if CheckB…”

  1. rvelthuis's avatar

    rvelthuis said

    These functions are (still) called AnsiXXX for reasons of backward compatibility. They got the Ansi prefix to indicate they use the current locale, i.e. in contrast to plain ASCII.

  2. thaddy's avatar

    thaddy said

    comp is a type. hurts my eyes…

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.