Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change type for fields denoting sizes #55

Open
ionut-arm opened this issue Mar 23, 2020 · 4 comments
Open

Change type for fields denoting sizes #55

ionut-arm opened this issue Mar 23, 2020 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ionut-arm
Copy link
Member

Most fields denoting sizes (e.g. of keys) are marked as usize at the moment. To make it less ambiguous, the ones representing sizes in bits should be set to u16, u32 or other types unrelated to word size on current platform (as the size itself is not related to the memory of the platform)

@ionut-arm ionut-arm added the bug Something isn't working label Mar 23, 2020
@ionut-arm ionut-arm added this to the Rustification milestone Mar 23, 2020
@ionut-arm ionut-arm added the good first issue Good for newcomers label Mar 24, 2020
@hug-dev
Copy link
Member

hug-dev commented Aug 7, 2020

Is it still needed? We went back on this idea for PSA Crypto I believe

@Superhepper
Copy link
Collaborator

This is still needed and should perhaps be added as coding guideline. Because I still do this mistake of just using usize.

@ionut-arm
Copy link
Member Author

should perhaps be added as coding guideline

While I'd love to have coding guidelines and be very explicit about how to handle various cases, at least from my experience it's difficult to actually keep them all in mind when coding (or when reviewing code). Maybe we should write some guidelines up nonetheless, so that we have something to fall back onto when debating how things should be implemented in a PR.

@ionut-arm
Copy link
Member Author

Is it still needed? We went back on this idea for PSA Crypto I believe

We went back on this idea for PSA Crypto because that spec explicitly uses usize for those sort of types, but I'm still not convinced it's as clear-cut

@ionut-arm ionut-arm removed this from the Rustification milestone Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants