You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should be a new rule, not an improvement to an existing rule.
This rule would be generally useful, not specific to my code or setup.
Suggested rule title
Pointers parameters should have the right size
Rule description
Check that pointer parameters have the right size according to the compiler architecture.
Rationale
In a migration process from Win32 to Win64, I encountered this error :
n := tmpp.Count;
p := nil;
DynArraySetLength(p, field_type, 1, @n);
The code was build for Win32, so n was an Integer
Now DynArraySetLength takes a PNativeInt which is 64bits wide under Win64 and the Delphi compiler does not emit a single warning about this critical issue.
Would be awesome if Sonarqube could help finding those problems.
The text was updated successfully, but these errors were encountered:
Yes, it has global scope. You'd have to deal with the stricter type checking in all compiled code.
Assuming you're using the precompiled RTL and precompiled 3rd party code, then it should only be an issue for the first party code — where you are able to fix the compiler errors.
This could be a nice "progressive enhancement" sort of rule where you slowly migrate a codebase to using the {T+} directive, or a compromise where you want to enforce this in all of your application code but can't enable the directive due to noncompliant 3rdParty code being built into your project.
Prerequisites
Suggested rule title
Pointers parameters should have the right size
Rule description
Check that pointer parameters have the right size according to the compiler architecture.
Rationale
In a migration process from Win32 to Win64, I encountered this error :
The code was build for Win32, so
n
was anInteger
Now
DynArraySetLength
takes aPNativeInt
which is 64bits wide under Win64 and the Delphi compiler does not emit a single warning about this critical issue.Would be awesome if Sonarqube could help finding those problems.
The text was updated successfully, but these errors were encountered: