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
Early versions of wsts used usize types anywhere that the code would deal with the size of memory. But this is problematic when sending data over the network, since usize is a platform dependent type.
So at some point we changed all public integer types to be fixed size, i.e. u32 or u64. This required sprinkling as usize casts where needed. However, @jferrant discovered that as usize casts will fail silently if the cast value is improperly sized.
As a result, we now call try_into().unwrap() to handle all casts between u32/u64 and usize. The logic was that while these can fail, they are extremely unlikely to do so, and if they do it's likely a result of a misconfiguration that should be noticed and fixed.
However, since this is library code, it is bad form to ever panic when an error could be returned instead. So this issue will track work to remove these unwrap calls whenever feasible.
The text was updated successfully, but these errors were encountered:
Early versions of
wsts
usedusize
types anywhere that the code would deal with the size of memory. But this is problematic when sending data over the network, sinceusize
is a platform dependent type.So at some point we changed all public integer types to be fixed size, i.e.
u32
oru64
. This required sprinklingas usize
casts where needed. However, @jferrant discovered thatas usize
casts will fail silently if the cast value is improperly sized.As a result, we now call
try_into().unwrap()
to handle all casts betweenu32
/u64
andusize
. The logic was that while these can fail, they are extremely unlikely to do so, and if they do it's likely a result of a misconfiguration that should be noticed and fixed.However, since this is library code, it is bad form to ever
panic
when an error could be returned instead. So this issue will track work to remove theseunwrap
calls whenever feasible.The text was updated successfully, but these errors were encountered: