Couple quick fixes/suggestions #27637
Open
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Under PlatformIO icon > Project Tasks > STM32F103RE_creality (or any other selected board) > Advanced > Check
this will perform a sort of debugging check, and I found some things that probably could use improvements.
For types.h
Warning
[low:style] Parameter 'data' can be declared as const array [constParameter] indicates that the parameter data can be declared as a constant array because it is not modified inside the constructor. Specifically, you're passing data[] as an array of uint8_t values to the constructor, but you don't modify the array, just use a reference to an element in it.
Problem
The warning suggests that you should use const for the data parameter to ensure that it is not accidentally modified, and to communicate clearly that the array will not be changed within the constructor.
Solution
Since you're only using data_ to refer to a specific element in the array and never modifying the array itself, you should declare data[] as a const uint8_t[] in the constructor.
Conclusion
However, making these changing causes errors.
Actual changes
Removed forward declaration of
Used
class BitProxy;
as forward declaration insteadRequirements
Benefits
Configurations
Related Issues
One of these checks could be looked into.
this basically is saying to add
&
toFI void set(const XYval<T> &pxy) ...
to be passed by reference instead of value, which may free up some space or what not.