You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside the closure, set the initializedCount parameter to the number of elements that are initialized by the closure. The memory in the range buffer[0..<initializedCount]must be initialized at the end of the closure’s execution, and the memory in the range buffer[initializedCount...] must be uninitialized. This postcondition must hold even if the initializer closure throws an error.
The text was updated successfully, but these errors were encountered:
this is only a breach-of-contract in the generic case; because UInt8 is a trivial type, it should be perfectly valid to leave the memory uninitialized. i am reluctant to have PNG.Data.Rectangular be backed by a managed buffer or some sort because there are a lot of benefits to having it backed by a normal Array
https://github.com/kelvin13/swift-png/blob/075dfb248ae327822635370e9d4f94a5d3fe93b2/sources/png/decoder.swift#L289
https://developer.apple.com/documentation/swift/array/init(unsafeuninitializedcapacity:initializingwith:):
Discussion
Inside the closure, set the
initializedCount
parameter to the number of elements that are initialized by the closure. The memory in the rangebuffer[0..<initializedCount]
must be initialized at the end of the closure’s execution, and the memory in the rangebuffer[initializedCount...]
must be uninitialized. This postcondition must hold even if the initializer closure throws an error.The text was updated successfully, but these errors were encountered: