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
I read the following suggestion for uninitialized variables in the detector doc:
If a variable is meant to be initialized to zero, explicitly set it to zero.
This not the best solution to deal with this as Solidity sets the value to 0 by default, if a variable is not initialized.
Moreover, explicitly initializing a variable (that is meant to be =0), to zero just costs more gas.
We recommend to always explicitly set the variable to its default value. This is because when reviewing something like
function f() public{
unit my_var;
// [..]
}
The reader cannot determine if my_var is supposed to be zero or not. While doing
function f() public{
unit my_var = 0;
// [..]
}
Make the code more readable and avoid ambiguities.
If you want to remove these results manually, you can add // slither-disable-next-line uninitialized-local and // slither-disable-next-line uninitialized-state before the variables.
I read the following suggestion for
uninitialized variables
in the detector doc:This not the best solution to deal with this as Solidity sets the value to 0 by default, if a variable is not initialized.
Moreover, explicitly initializing a variable (that is meant to be =0), to zero just costs more gas.
Following are it's occurences:
Please make the desired changes.
Thanks
The text was updated successfully, but these errors were encountered: