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
types.StrictFlags is not "strict" in the strict sense beacuse of flag FlagClipNegativeToZero
The flag FlagClipNegativeToZero is zero in types.StrictFlags. It means when converting an negative to unsigned, the cast will succeed without any error or warning.
For example, if we converting -1 to unsigned. The types.StrictFlags will cast it to the max int value. Only if we set FlagClipNegativeToZero to 1, it will be recognized as an overflow error.
It's better to remove FlagClipNegativeToZero and introduce a new flag FlagAllowNegativeToUnsigned to replace it. When FlagAllowNegativeToUnsigned is not set by default, converting a negative value to unsigned will return an overflow error, otherwise, the negative value will be casted to an relatives positive value
The text was updated successfully, but these errors were encountered:
types.StrictFlags
is not "strict" in the strict sense beacuse of flagFlagClipNegativeToZero
The flag
FlagClipNegativeToZero
is zero intypes.StrictFlags
. It means when converting an negative to unsigned, the cast will succeed without any error or warning.For example, if we converting
-1
to unsigned. Thetypes.StrictFlags
will cast it to the max int value. Only if we setFlagClipNegativeToZero
to 1, it will be recognized as an overflow error.It's better to remove
FlagClipNegativeToZero
and introduce a new flagFlagAllowNegativeToUnsigned
to replace it. WhenFlagAllowNegativeToUnsigned
is not set by default, converting a negative value to unsigned will return an overflow error, otherwise, the negative value will be casted to an relatives positive valueThe text was updated successfully, but these errors were encountered: