[swift-users] Why will RawByte be deprecated in Swift 3?

Dmitri Gribenko gribozavr at gmail.com
Fri Feb 12 22:38:26 CST 2016

On Fri, Feb 12, 2016 at 2:34 AM, Marco Masser via swift-users
<swift-users at swift.org> wrote:
> There’s a RawByte struct in the Swift 2.2 standard library:
> /// A byte-sized thing that isn't designed to interoperate with
> /// any other types; it makes a decent parameter to
> /// `UnsafeMutablePointer<Memory>` when you just want to do bytewise
> /// pointer arithmetic.
> @available(*, deprecated, message="it will be removed in Swift 3")
> public struct RawByte {
> }
> Why is that deprecated? On the current Swift master branch (22c4d7d) it’s
> still used in the String-related code and there’s also no mention about it
> being deprecated. Is there a replacement for RawByte? Should I just write my
> own version when I don’t want Int8 or UInt8 to mean “just a byte”?

Using UInt8 or Int8 is recommended.

> Bonus question: Where does this deprecation come from? How can something be
> deprecated in the public Swift release when it’s not deprecated in the Swift
> source?

It comes from a preview implementation of SE-0006


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-users mailing list