Recent

Author Topic: [CLOSED] Code cleanup at function GetInterfaceProp  (Read 1667 times)

lagprogramming

  • Sr. Member
  • ****
  • Posts: 407
[CLOSED] Code cleanup at function GetInterfaceProp
« on: April 24, 2023, 03:36:15 pm »
rtl/objpas/typinfo.pp has function GetInterfaceProp(Instance: TObject; PropInfo: PPropInfo): IInterface;
Code: Pascal  [Select][+][-]
  1. function GetInterfaceProp(Instance: TObject; PropInfo: PPropInfo): IInterface;
  2. type
  3.   TGetInterfaceProc=function:IInterface of object;
  4.   TGetInterfaceProcIndex=function(index:longint):IInterface of object;
  5. var
  6.   AMethod : TMethod;
  7. begin
  8.   Result:=nil;
  9.   case (PropInfo^.PropProcs) and 3 of
  10.     ptField:
  11.       Result:=IInterface(PPointer(Pointer(Instance)+PtrUInt(PropInfo^.GetProc))^);
  12.     ptStatic,
  13.     ptVirtual:
  14.       begin
  15.         if (PropInfo^.PropProcs and 3)=ptStatic then
  16.           AMethod.Code:=PropInfo^.GetProc
  17.         else
  18.           AMethod.Code:=PCodePointer(Pointer(Instance.ClassType)+PtrUInt(PropInfo^.GetProc))^;
  19.         AMethod.Data:=Instance;
  20.         if ((PropInfo^.PropProcs shr 6) and 1)<>0 then
  21.           Result:=TGetInterfaceProcIndex(AMethod)(PropInfo^.Index)
  22.         else
  23.           Result:=TGetInterfaceProc(AMethod)();
  24.       end;
  25.   else
  26.     raise EPropertyError.CreateFmt(SErrCannotReadProperty, [PropInfo^.Name]);
  27.   end;
  28. end;
The following patch removes the initial "Result:=nil;" line. If the patch is accepted, regarding result assignments, the patch will make the function look closer to other functions in the same file like Function IsStoredProp(Instance : TObject;PropInfo : PPropInfo) : Boolean; or Function GetPointerProp(Instance: TObject; PropInfo : PPropInfo): Pointer;.
Code: Pascal  [Select][+][-]
  1. diff --git a/rtl/objpas/typinfo.pp b/rtl/objpas/typinfo.pp
  2. index da6a889b08..7ffaefc081 100644
  3. --- a/rtl/objpas/typinfo.pp
  4. +++ b/rtl/objpas/typinfo.pp
  5. @@ -2302,7 +2302,6 @@ function GetInterfaceProp(Instance: TObject; PropInfo: PPropInfo): IInterface;
  6.  var
  7.    AMethod : TMethod;
  8.  begin
  9. -  Result:=nil;
  10.    case (PropInfo^.PropProcs) and 3 of
  11.      ptField:
  12.        Result:=IInterface(PPointer(Pointer(Instance)+PtrUInt(PropInfo^.GetProc))^);
« Last Edit: April 25, 2023, 10:24:04 am by lagprogramming »

AlexTP

  • Hero Member
  • *****
  • Posts: 2577
    • UVviewsoft
Re: Code cleanup at function GetInterfaceProp
« Reply #1 on: April 24, 2023, 04:56:45 pm »


wp

  • Hero Member
  • *****
  • Posts: 12908
Re: [CLOSED] Code cleanup at function GetInterfaceProp
« Reply #3 on: April 25, 2023, 10:37:13 am »
What's wrong with clearly assigning a result to a function? Even if the assignment is unnecessary it improves readability of the code. I agree with Michael's decision not to apply this.


AlexTP

  • Hero Member
  • *****
  • Posts: 2577
    • UVviewsoft
Re: [CLOSED] Code cleanup at function GetInterfaceProp
« Reply #5 on: April 25, 2023, 01:58:11 pm »
I agree with Michael's decision.

lagprogramming

  • Sr. Member
  • ****
  • Posts: 407
Re: [CLOSED] Code cleanup at function GetInterfaceProp
« Reply #6 on: April 25, 2023, 06:09:07 pm »
What's wrong with clearly assigning a result to a function? Even if the assignment is unnecessary it improves readability of the code. I agree with Michael's decision not to apply this.
Having a default result as the first line is a common practice. If you got used to this practice, it's presence might increase readability for you. I don't want to start a discussion on recommended(good) programming practices for FreePascal because I know for sure it won't be a polite discussion on the forum. Things will escalate almost intantly because a good/recommended programming practice for FreePascal would challenge most of the experienced developers here.
Readability(and maintenance) of the code is important beyond doubts. But unlike the speed of the routines in LCL, the speed of the routines in rtl is much more important. In the last three months, the forum had about two topics regarding slow graphic routines. If we would make a connection with fpc, the connection would be made to the fcl-image package. Fcl-image is just a package, the rtl is more important. Look at how many rtl optimizations are proposed in the bug tracker. Sometimes the speed of rtl routines might be considered more important than code readability.
Many years ago, independent of FPC developers, a number of rtl routines have been modified. The modifications were based on recommended programming practices for FreePascal. All those new for you versions of graphic routines that improve CPU cache usage are in fact ancient for others, many years old. Another programming practice that has been used was to avoid the initial default result assignments.
Here is an example, same optimization level, same fpc development version, only the code of function TProcess.Terminate has been changed.
Code: Pascal  [Select][+][-]
  1. Function TProcess.Terminate(AExitCode : Integer) : Boolean;
  2.  
  3. begin
  4.   Result:=False;
  5.   Result:=fpkill(Handle,SIGTERM)=0;
  6.   If Result then
  7.     begin
  8.     If Running then
  9.       Result:=fpkill(Handle,SIGKILL)=0;
  10.     end;
  11.   { the fact that the signal has been sent does not
  12.     mean that the process has already handled the
  13.     signal -> wait instead of calling getexitstatus }
  14.   if Result then
  15.     WaitOnExit;
  16. end;
  17.  
  18. PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN
  19. 00000000006EC260 53                       push rbx
  20. 00000000006EC261 4154                     push r12
  21. 00000000006EC263 50                       push rax
  22. 00000000006EC264 4889FB                   mov rbx,rdi
  23. 00000000006EC267 30C0                     xor al,al
  24. 00000000006EC269 8BBF30010000             mov edi,[rdi+$00000130]
  25. 00000000006EC26F BE0F000000               mov esi,$0000000F
  26. 00000000006EC274 E8C74AD7FF               call -$0028B539    # $0000000000460D40 BASEUNIX_$$_FPKILL$LONGINT$LONGINT$$LONGINT
  27. 00000000006EC279 85C0                     test eax,eax
  28. 00000000006EC27B 410F94C4                 setz r12b
  29. 00000000006EC27F 752F                     jnz +$2F    # $00000000006EC2B0 PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN+80
  30. 00000000006EC281 4889DF                   mov rdi,rbx
  31. 00000000006EC284 E807060000               call +$00000607    # $00000000006EC890 PROCESS$_$TPROCESS_$__$$_GETRUNNING$$BOOLEAN
  32. 00000000006EC289 84C0                     test al,al
  33. 00000000006EC28B 7416                     jz +$16    # $00000000006EC2A3 PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN+67
  34. 00000000006EC28D 8BBB30010000             mov edi,[rbx+$00000130]
  35. 00000000006EC293 BE09000000               mov esi,$00000009
  36. 00000000006EC298 E8A34AD7FF               call -$0028B55D    # $0000000000460D40 BASEUNIX_$$_FPKILL$LONGINT$LONGINT$$LONGINT
  37. 00000000006EC29D 85C0                     test eax,eax
  38. 00000000006EC29F 410F94C4                 setz r12b
  39. 00000000006EC2A3 4584E4                   test r12b,r12b
  40. 00000000006EC2A6 7408                     jz +$08    # $00000000006EC2B0 PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN+80
  41. 00000000006EC2A8 4889DF                   mov rdi,rbx
  42. 00000000006EC2AB E8F0FDFFFF               call -$00000210    # $00000000006EC0A0 PROCESS$_$TPROCESS_$__$$_WAITONEXIT$$BOOLEAN
  43. 00000000006EC2B0 4488E0                   mov al,r12b
  44. 00000000006EC2B3 59                       pop rcx
  45. 00000000006EC2B4 415C                     pop r12
  46. 00000000006EC2B6 5B                       pop rbx
  47. 00000000006EC2B7 C3                       ret
  48. 00000000006EC2B8 0000                     add [rax],al
  49. 00000000006EC2BA 0000                     add [rax],al
  50. 00000000006EC2BC 0000                     add [rax],al
  51. 00000000006EC2BE 0000                     add [rax],al
Code: Pascal  [Select][+][-]
  1. Function TProcess.Terminate(AExitCode:Integer):Boolean;
  2. begin
  3.   if fpkill(Handle,SIGTERM)=0 then
  4.     if Running then
  5.       if fpkill(Handle,SIGKILL)=0 then
  6.         begin
  7.           { the fact that the signal has been sent does not
  8.            mean that the process has already handled the
  9.            signal -> wait instead of calling getexitstatus }
  10.           WaitOnExit;
  11.           Result:=True;
  12.           Exit;
  13.         end;
  14.   Result:=False;
  15. end;
  16.  
  17. PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN
  18. 00000000006EC1C0 53                       push rbx
  19. 00000000006EC1C1 4889FB                   mov rbx,rdi
  20. 00000000006EC1C4 8BBF30010000             mov edi,[rdi+$00000130]
  21. 00000000006EC1CA BE0F000000               mov esi,$0000000F
  22. 00000000006EC1CF E8CC4AD7FF               call -$0028B534    # $0000000000460CA0 BASEUNIX_$$_FPKILL$LONGINT$LONGINT$$LONGINT
  23. 00000000006EC1D4 85C0                     test eax,eax
  24. 00000000006EC1D6 7530                     jnz +$30    # $00000000006EC208 PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN+72
  25. 00000000006EC1D8 4889DF                   mov rdi,rbx
  26. 00000000006EC1DB E800060000               call +$00000600    # $00000000006EC7E0 PROCESS$_$TPROCESS_$__$$_GETRUNNING$$BOOLEAN
  27. 00000000006EC1E0 84C0                     test al,al
  28. 00000000006EC1E2 7424                     jz +$24    # $00000000006EC208 PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN+72
  29. 00000000006EC1E4 8BBB30010000             mov edi,[rbx+$00000130]
  30. 00000000006EC1EA BE09000000               mov esi,$00000009
  31. 00000000006EC1EF E8AC4AD7FF               call -$0028B554    # $0000000000460CA0 BASEUNIX_$$_FPKILL$LONGINT$LONGINT$$LONGINT
  32. 00000000006EC1F4 85C0                     test eax,eax
  33. 00000000006EC1F6 7510                     jnz +$10    # $00000000006EC208 PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN+72
  34. 00000000006EC1F8 4889DF                   mov rdi,rbx
  35. 00000000006EC1FB E800FEFFFF               call -$00000200    # $00000000006EC000 PROCESS$_$TPROCESS_$__$$_WAITONEXIT$$BOOLEAN
  36. 00000000006EC200 B001                     mov al,$01
  37. 00000000006EC202 EB06                     jmp +$06    # $00000000006EC20A PROCESS$_$TPROCESS_$__$$_TERMINATE$LONGINT$$BOOLEAN+74
  38. 00000000006EC204 0F1F4000                 nop dword ptr [rax+$00]
  39. 00000000006EC208 30C0                     xor al,al
  40. 00000000006EC20A 5B                       pop rbx
  41. 00000000006EC20B C3                       ret
  42. 00000000006EC20C 0000                     add [rax],al
  43. 00000000006EC20E 0000                     add [rax],al
I couldn't find quick enough a function in rtl that has only the initial result assignment removed, where it's value fits the size of a register. Looking at the code produced, you would want to run the code produced for the modified version of TProcess.Terminate, not the official code. When the Result is ansistring the situation gets worse because the Result:=''; assignment calls fpc_ansistr_assign. Again, you would like to use the modified version of function TStrings.Shift: String; not the official one.
Code: Pascal  [Select][+][-]
  1. function TStrings.Shift: String;
  2.  
  3. begin
  4.   Result:='';
  5.   if (Count > 0) then
  6.     begin
  7.     Result:=Strings[0];
  8.     Delete(0);
  9.     end;
  10. end;
  11. CLASSES$_$TSTRINGS_$__$$_SHIFT$$ANSISTRING
  12. 00000000004A1D40 53                       push rbx
  13. 00000000004A1D41 4154                     push r12
  14. 00000000004A1D43 50                       push rax
  15. 00000000004A1D44 4889FB                   mov rbx,rdi
  16. 00000000004A1D47 4989F4                   mov r12,rsi
  17. 00000000004A1D4A 4889F7                   mov rdi,rsi
  18. 00000000004A1D4D 31F6                     xor esi,esi
  19. 00000000004A1D4F E84C51F8FF               call -$0007AEB4    # $0000000000426EA0 fpc_ansistr_assign
  20. 00000000004A1D54 4889DF                   mov rdi,rbx
  21. 00000000004A1D57 488B03                   mov rax,[rbx]
  22. 00000000004A1D5A FF9008010000             call qword ptr [rax+$00000108]
  23. 00000000004A1D60 85C0                     test eax,eax
  24. 00000000004A1D62 7E1F                     jle +$1F    # $00000000004A1D83 CLASSES$_$TSTRINGS_$__$$_SHIFT$$ANSISTRING+67
  25. 00000000004A1D64 4C89E6                   mov rsi,r12
  26. 00000000004A1D67 31D2                     xor edx,edx
  27. 00000000004A1D69 4889DF                   mov rdi,rbx
  28. 00000000004A1D6C 488B03                   mov rax,[rbx]
  29. 00000000004A1D6F FF90F8000000             call qword ptr [rax+$000000F8]
  30. 00000000004A1D75 31F6                     xor esi,esi
  31. 00000000004A1D77 4889DF                   mov rdi,rbx
  32. 00000000004A1D7A 488B03                   mov rax,[rbx]
  33. 00000000004A1D7D FF9090010000             call qword ptr [rax+$00000190]
  34. 00000000004A1D83 59                       pop rcx
  35. 00000000004A1D84 415C                     pop r12
  36. 00000000004A1D86 5B                       pop rbx
  37. 00000000004A1D87 C3                       ret
  38. 00000000004A1D88 0000                     add [rax],al
  39. 00000000004A1D8A 0000                     add [rax],al
  40. 00000000004A1D8C 0000                     add [rax],al
  41. 00000000004A1D8E 0000                     add [rax],al
Code: Pascal  [Select][+][-]
  1. function TStrings.Shift: String;
  2. begin
  3.   if (Count > 0) then
  4.     begin
  5.     Result:=Strings[0];
  6.     Delete(0);
  7.     end
  8.   else
  9.     Result:='';
  10. end;
  11.  
  12. CLASSES$_$TSTRINGS_$__$$_SHIFT$$ANSISTRING
  13. 00000000004A1D40 53                       push rbx
  14. 00000000004A1D41 4154                     push r12
  15. 00000000004A1D43 50                       push rax
  16. 00000000004A1D44 4889FB                   mov rbx,rdi
  17. 00000000004A1D47 4989F4                   mov r12,rsi
  18. 00000000004A1D4A 488B07                   mov rax,[rdi]
  19. 00000000004A1D4D FF9008010000             call qword ptr [rax+$00000108]
  20. 00000000004A1D53 85C0                     test eax,eax
  21. 00000000004A1D55 7E29                     jle +$29    # $00000000004A1D80 CLASSES$_$TSTRINGS_$__$$_SHIFT$$ANSISTRING+64
  22. 00000000004A1D57 4C89E6                   mov rsi,r12
  23. 00000000004A1D5A 31D2                     xor edx,edx
  24. 00000000004A1D5C 4889DF                   mov rdi,rbx
  25. 00000000004A1D5F 488B03                   mov rax,[rbx]
  26. 00000000004A1D62 FF90F8000000             call qword ptr [rax+$000000F8]
  27. 00000000004A1D68 31F6                     xor esi,esi
  28. 00000000004A1D6A 4889DF                   mov rdi,rbx
  29. 00000000004A1D6D 488B03                   mov rax,[rbx]
  30. 00000000004A1D70 FF9090010000             call qword ptr [rax+$00000190]
  31. 00000000004A1D76 EB12                     jmp +$12    # $00000000004A1D8A CLASSES$_$TSTRINGS_$__$$_SHIFT$$ANSISTRING+74
  32. 00000000004A1D78 0F1F840000000000         nop dword ptr [rax+rax+$00000000]
  33. 00000000004A1D80 4C89E7                   mov rdi,r12
  34. 00000000004A1D83 31F6                     xor esi,esi
  35. 00000000004A1D85 E81651F8FF               call -$0007AEEA    # $0000000000426EA0 fpc_ansistr_assign
  36. 00000000004A1D8A 59                       pop rcx
  37. 00000000004A1D8B 415C                     pop r12
  38. 00000000004A1D8D 5B                       pop rbx
  39. 00000000004A1D8E C3                       ret
  40. 00000000004A1D8F 00488D                   add [rax-$73],cl

In addition, regarding code readability, I give you two examples:
Code: Pascal  [Select][+][-]
  1. function TCDWidgetSet.SetFocus(hWnd: HWND): HWND;
  2. var
  3.   lObject, lOldObject: TCDBaseControl;
  4.   lOldControl: TWinControl;
  5.   lHandle: TCDWinControl;
  6. begin
  7.   {$ifdef VerboseCDFocus}
  8.   DebugLn(Format('[TCDWidgetSet.SetFocus] Handle=%x', [hWnd]));
  9.   {$endif}
  10.   Result := 0;
  11.   // Strangly this breaks the Android Virtual Keyboard =(
  12.   // Remove the ifdef only when we can guarantee that this doesn't break Android Virtual Keyboard
  13.   {$ifndef CD_Android}
  14.   if hwnd = 0 then
  15.   begin
  16.     Result := GetFocus();
  17.     Exit;
  18.   end;
  19.   lObject := TCDBaseControl(hWnd);
  20.  
  21.   // SetFocus on a child control
  22.   if lObject is TCDWinControl then
  23.   begin
  24.     lHandle := TCDWinControl(lObject);
  25.  
  26.     // Set focus in the parent window
  27.     //Result := BackendSetFocus(hWnd);
  28.  
  29.     if lHandle.WinControl = nil then Exit;
  30.     CDSetFocusToControl(lHandle.WinControl, lHandle.CDControl);
  31.  
  32.     {$ifdef VerboseCDFocus}
  33.     DebugLn(Format(':[TCDWidgetSet.SetFocus] NewFocusedControl=%s NewFocusedIntfControl=%x', [FocusedControl.Name, PtrUInt(FocusedIntfControl)]));
  34.     {$endif}
  35.   end
  36.   // SetFocus on a form
  37.   else
  38.   begin
  39.     Result := BackendSetFocus(hWnd);
  40.   end;
  41.   {$endif}
  42. end;
function TCDWidgetSet.SetFocus(hWnd: HWND): HWND; has "Result := 0;" as the first line. Look at the code, if lObject is TCDWinControl should the result be zero!? Are you sure that the developer didn't forgot to overwrite the result value!? If the result assignment would have been done after "if lObject is TCDWinControl" I wouldn't have had this kind of questions. Look at the comment line "//Result := BackendSetFocus(hWnd);" Instead of helping me, the initial result assignment makes me feel like the function has a bug.
The second example is:
Code: Pascal  [Select][+][-]
  1. procedure DefaultReaderDescription(AWidth, AHeight: Integer; ADepth: Byte; out ADesc: TRawImageDescription);
  2. begin
  3.   // Default description, assume 24bit for palettebased
  4.   // Maybe when RawImage palette is supported, other descriptions need to be adjusted.
  5.  
  6.   ADesc.Init_BPP24_B8G8R8_M1_BIO_TTB(AWidth, AHeight);
  7.  
  8.   case ADepth of
  9.     1: begin
  10.       ADesc.Depth := 1;
  11.       ADesc.BitsPerPixel := 1;
  12.       ADesc.Format := ricfGray;
  13.       ADesc.LineEnd := rileWordBoundary;
  14.       ADesc.RedPrec := 1;
  15.       ADesc.RedShift := 0;
  16.       ADesc.GreenPrec := 1;
  17.       ADesc.GreenShift := 0;
  18.       ADesc.BluePrec := 1;
  19.       ADesc.BlueShift := 0;
  20.     end;
  21.     2..4: begin
  22. //      ADesc.Depth := 4;
  23. //      ADesc.BitsPerPixel := 4;
  24.     end;
  25.     5..8: begin
  26. //      ADesc.Depth := 8;
  27. //      ADesc.BitsPerPixel := 8;
  28.     end;
  29.     9..15: begin
  30.       ADesc.Depth := 15;
  31.       ADesc.BitsPerPixel := 16;
  32.       ADesc.RedPrec := 5;
  33.       ADesc.RedShift := 10;
  34.       ADesc.GreenPrec := 5;
  35.       ADesc.GreenShift := 5;
  36.       ADesc.BluePrec := 5;
  37.       ADesc.BlueShift := 0;
  38.     end;
  39.     16: begin
  40.       ADesc.Depth := 16;
  41.       ADesc.BitsPerPixel := 16;
  42.       ADesc.RedPrec := 5;
  43.       ADesc.RedShift := 10;
  44.       ADesc.GreenPrec := 6;
  45.       ADesc.GreenShift := 5;
  46.       ADesc.BluePrec := 5;
  47.       ADesc.BlueShift := 0;
  48.     end;
  49.     17..24: begin
  50.       // already default
  51.     end;
  52.   else
  53.     ADesc.Depth := 32;
  54.     ADesc.BitsPerPixel := 32;
  55.     ADesc.AlphaPrec := 8;
  56.     ADesc.AlphaShift := 24;
  57.   end;
  58. end;
The above code has a bug. Now that I've told you that it has a bug, even though you realize it's related to the initial ADesc.Init_BPP24_B8G8R8_M1_BIO_TTB(AWidth, AHeight); line, it might not be easy to fix it. How much code do you think will be changed in that routine. I think a lot.
Regarding code readability, the above two routines point to the fact that sometimes those default lines at the start of routines, instead of helping, might make the code even harder to understand.

lagprogramming

  • Sr. Member
  • ****
  • Posts: 407
Re: Code cleanup at function GetInterfaceProp
« Reply #7 on: April 25, 2023, 06:11:33 pm »
https://gitlab.com/freepascal.org/fpc/source/-/commit/f6a8b045c2f52740186feca3d50c3211c74c775c
https://gitlab.com/freepascal.org/fpc/source/-/commit/abb7aebaba5721512c3d16857c78781c60259e66
https://gitlab.com/freepascal.org/fpc/source/-/commit/d7d65fe0d7b62c61f4751b896eb6ab9271d03a0c
Is there a reason you mention these commits in relation to that issue?
The first links show that even if an improvement might be considered minor, it is welcome in the official sources. That's what can be understood from those links.
The last link shows something totally different. A file has a couple of functions that look alike. A patch is presented that removes a default result assignment from a function, making the functions in the file one step closer to converging towards a single programming practice. The patch is refused. Don't the compiler developers want to have, one day, the same programming practice in that file!? Don't the compiler developers know which programming practice is better for rtl: having functions with default result assignments as the first line or having functions without them!? Could it be that the compiler developers want a patch that modifies all the functions at once(if that would be true, it would be against the understanding of the first links, where even a space character matters).
I don't know why the patch has been rejected. Maybe the compiler developers love diversity in that file very much. To be frank, I've presented the patch, job done.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6035
  • Compiler Developer
Re: Code cleanup at function GetInterfaceProp
« Reply #8 on: April 26, 2023, 03:55:30 pm »
https://gitlab.com/freepascal.org/fpc/source/-/commit/f6a8b045c2f52740186feca3d50c3211c74c775c
https://gitlab.com/freepascal.org/fpc/source/-/commit/abb7aebaba5721512c3d16857c78781c60259e66
https://gitlab.com/freepascal.org/fpc/source/-/commit/d7d65fe0d7b62c61f4751b896eb6ab9271d03a0c
Is there a reason you mention these commits in relation to that issue?
The first links show that even if an improvement might be considered minor, it is welcome in the official sources. That's what can be understood from those links.

Fixing typos is different from fixing code. A “superfluous” Result assignment is much less annoying to me than a typo, cause those stand out to me like a sore spot.

The last link shows something totally different. A file has a couple of functions that look alike. A patch is presented that removes a default result assignment from a function, making the functions in the file one step closer to converging towards a single programming practice. The patch is refused.

And MvC said that he prefers the way that this function uses compared to the others.

Don't the compiler developers want to have, one day, the same programming practice in that file!?

That is honestly the least of our problems.

 

TinyPortal © 2005-2018