-
Notifications
You must be signed in to change notification settings - Fork 9
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
Introduce a byte-type #68
Comments
For reference, it sounds like it might be analogous to the C++ |
I don't think this is worth the added complexity of another type. We use |
Given the C++ comparison, it's worth pointing out that C++ added this type specifically to deal with the fact that
(and for completeness, here's the proposal for adding it, which is basically spelling that out in more detail)
The one part of C++'s motivation that does apply is that with raw bytes, only bitwise operators really make sense, and using one of the +-*/ arithmetic operators is likely a mistake, hence I have no strong opinion on whether Rust should have a byte type. I could easily see unsafe code guidelines or allocators or whatever ending up in a place where having one allows better UB checking or static UB prevention. But I am confident that the prior art of C++ is largely irrelevant to this question. |
Closing as of #68 (comment) and #66 (comment). |
The allocator-api currently only uses
u8
as representation for a byte. I like to discuss if a type is worth to introduce (lets call itbyte
here). This is basically an alternative to #66.Advantages:
u8
is an unsigned number, which must not have uninitialized bits (see Clarify unsafe requirements of AllocRef #65)byte
or[byte]
+&
,*const
,*mut
,NonNull
)Downsides:
The text was updated successfully, but these errors were encountered: