Data should have a zeroing initializer

Originator:robnapier
Number:rdar://26877993 Date Originated:18-Jun-2016 11:30 AM
Status: Resolved:
Product:Swift Product Version:3
Classification: Reproducible:
 
NSMutableData(length:) allows you to easily and efficiently initialize a buffer to a given length of all zeros. Data() has no similar initializer, requiring callers to initialize with resetBytes, or copying an Array, or using a temporary UInt8 variable with bytes:count. These are less convenient, and may be less efficient than NSMutableData(length:)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!