> On 23 Sep 2016, at 17:08, Svein Halvor Halvorsen via swift-users 
> <swift-users@swift.org> wrote:
> 
> var bitfield: UnsafeMutablePointer<UInt8>?
> bitfield = UnsafeMutablePointer<UInt8>.allocate(capacity: 888)
> 

Excellent! 
I see that “- Postcondition: The pointee is allocated, but not initialized.”

What about calloc then? Or use allocate and do a memset afterwards?

Thanks a lot for your help!

Kind regards,

Gerriet.



>> 23. sep. 2016 kl. 10.47 skrev Gerriet M. Denkmann via swift-users 
>> <swift-users@swift.org>:
>> 
>> 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?
>> 
>> Gerriet.
>> 
>> _______________________________________________
>> swift-users mailing list
>> swift-users@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
> 
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

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

Reply via email to