Bad code of the day

Bad code of the day

var C: PChar;
begin
  C := 'Test';

Comments

  1. A. Bouchez
     If I read your argument carefully. I do believe you agree that a const char* in Delphi would prevent a number of programmer errors. If only the programmer were smarter/more careful/better/stronger etc we would not need this, I agree, but it would help in a limited number of use case. And even better because it is a compile time thing. It would not affect code generation.
    A pure win in my book.

    One of the reasons we stick with Delphi is not that is such a great compiler (it isn't), nor that it generates good code (it's meh.). But that the language itself is such a joy to work with. Improving the language (even if just a tiny bit) would be improving its strong points. Always a good strategy in my book.

    ReplyDelete
  2. A. Bouchez​ I can't make sense of any of that.

    ReplyDelete
  3. David Heffernan This is Arnaud's language fault, not Delphi's, for sure. ;)

    ReplyDelete

Post a Comment