> On 23 Sep 2016, at 15:47, Gerriet M. Denkmann via swift-users 
> <swift-users@swift.org> wrote:
> 
> This used to work in Swift 2.2:
> 
> var bitfield: UnsafeMutablePointer<UInt8>?
> bitfield = UnsafeMutablePointer<UInt8>( malloc( 888 ) )
> 
> How is this written in Swift 3.0?

To answer my own question:
This works:
var bitfield: UnsafeMutableRawPointer   
bitfield = UnsafeMutableRawPointer( malloc(888))

But then this stops working:
let theByte = self.bitfield[ 5 ] 

Somehow the bitfield must know that it is a field of bytes (not shorts, ints or 
whatever). But how?

Gerriet.

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to