title: Is it safe to use [NSData dataWithBytesNoCopy: ... freeWhenDone:NO] with a const byte array as input?
body: <p>I have a large binary resource in my code, converted to an array using a bin2c type program.</p>
  
  <p>Previously, we are using <code>[NSData dataWithBytes:raw length:rawLength]</code> to read the resource (for example).</p>
  
  <p>This is a very large array (>32KB) and the whole procedure around loading and using this resource is slow at the moment so I am trying to make time savings where I can (no I haven't explicitly profiled the copy vs noCopy at this time).</p>
  
  <p>I am just wondering, since <code>dataWithBytesNoCopy:</code> takes a <code>void*</code> and not <code>const void*</code>, does this mean it is not safe to use this from a constant source (in this case it is compiled into the program executable).</p>
  
  <p>I don't think it is an oversight from the NSData developers since <code>initWithBytes:</code> and <code>dataWithBytes:</code> both take <code>const void*</code> as the parameter - what (if anything) does NSData do to the input data when not const, considering that NSData itself is immutable?</p>
  
  <p>I wonder if perhaps the parameter defined as not <code>const</code> for forward compatibility with NSMutableData?</p>