Einzelnen Beitrag anzeigen

Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#65

AW: Neuer FixInsight ist da!

  Alt 3. Mär 2016, 10:14
I have updated from 2015.10 to 2015.11 and would like to report a few things:

Fatal Parse error
caused by the following code:
Delphi-Quellcode:
function TSomeClass.calcSomething(const someCount: Integer): Integer;
begin
   Result := 'REG11111;2;33333333;44444444;55555555'.Length * someCount; // <-- This line
   [...]
end;
This did not cause a fatal error in 2015.10

C110: Getter or setter name is different from property declaration
The following code causes a C110. I guess it's because of the "&":
Delphi-Quellcode:
      public property
         &Register[index: TRegisterIndex]: TRegisterValue
            read getRegister
            write setRegister;
            default;

W521 Return value of function might be undefined
The following code did not cause this warning in 2015.10:

Delphi-Quellcode:
type TSomeEnum = (uno, dos, tres);

function TSomeClass.getSomeValue(): TSomeEnum;
begin
   if someCondition() then
      Exit(TSomeEnum.uno)
   else
      if someOtherCondition() then
         Exit(TSomeEnum.dos)
      else
         Exit(TSomeEnum.tres);
end;
O802 ResourceString is declared but never used
That's an excellent idea!

W528: Variable not used in for-loop
This is strange one. The following code produces a W528:

Delphi-Quellcode:
unit Unit1;

interface uses System.Generics.Collections, System.SysUtils;

type

   TPair = System.Generics.Collections.TPair<Single, Single>;
   TPairs = TArray<TPair>;

   TPairsExporter = class
      public class function DataAsString(const pairs: TPairs): String;
   end;

implementation uses System.Classes;

class function TPairsExporter.DataAsString(const pairs: TPairs): String;
var
   stringBuilder:   TStringBuilder;
   pair:          TPair;
begin
   stringBuilder := TStringBuilder.Create();
   try
      for pair in pairs do
         stringBuilder.Append(pair.Key).Append(sLineBreak);

      Result := stringBuilder.ToString();
   finally
      stringBuilder.Destroy();
   end;
end;

end.
.

If you remove the ".Append(sLineBreak)", the warning is gone. Oh, and please ignore the fact that using a for..in with records was not the best idea
  Mit Zitat antworten Zitat