<div dir="ltr"><span style="font-size:12.8px">&gt; The comments in the generated header for UnsafeMutablePointer claim that its regular init() method constructs a null pointer.</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">That&#39;s right, and I have tried it as well. Yet, type inference doesn&#39;t like like it, and I get back an error similar to what I have already described, but this time with inout and UnsafeMutablePointer:</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">    </span>result values in &#39;? :&#39; expression have mismatching types &#39;inout T&#39; and &#39;UnsafeMutablePointer&lt;T&gt;&#39;</div><div><br></div>















</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 24, 2015 at 7:56 AM, Charles Srstka <span dir="ltr">&lt;<a href="mailto:cocoadev@charlessoft.com" target="_blank">cocoadev@charlessoft.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><blockquote type="cite">On Dec 23, 2015, at 7:50 PM, Félix Cloutier via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</blockquote><div><blockquote type="cite"><br><div><span style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:LucidaGrande">The &amp; operator isn&#39;t exactly an address-of operator. Does &amp;arr[0] even return a pointer to the inner buffer? When you use &amp; with properties (and possibly with subscripts as well), Swift may create a local, copy the property value to it, pass a pointer to that local, and copy back the output to the property.</span><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:LucidaGrande"><br></div><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:LucidaGrande">Anyway, you are probably looking for Array.withUnsafe(Mutable?)BufferPointer:</div><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:LucidaGrande"><br></div><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:LucidaGrande">arr.withUnsafeMutableBufferPointer { foo($0, $0.count) }</div><div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-family:LucidaGrande"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="border-collapse:separate;line-height:normal;border-spacing:0px">Félix</span></div></div></blockquote></div><br></span><div>The comments in the generated header for UnsafeMutablePointer claim that its regular init() method constructs a null pointer. Therefore, I think you should just be able to:</div><div><br></div><div>foo(UnsafeMutablePointer&lt;T&gt;(), 0)</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Charles</div><div><br></div></font></span></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><font color="#000000" face="monospace" size="3">Author of the Sparkling language</font><div><font color="#000000" face="monospace" size="3"><a href="http://h2co3.org" target="_blank">http://h2co3.org/</a><br></font></div><div><font color="#000000" face="monospace" size="3"><br></font></div></div></div>
</div>