<div dir="ltr">Indeed, that&#39;s good to know. Thanks for the clarification!<div><br></div><div>Austin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 7, 2016 at 1:22 PM, Félix Cloutier <span dir="ltr">&lt;<a href="mailto:felixcca@yahoo.ca" target="_blank">felixcca@yahoo.ca</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">It is. This:<div><br></div><div><div></div><blockquote type="cite"><div>func foo(ptr: UnsafeMutablePointer&lt;Int32&gt;) {</div><div><span style="white-space:pre-wrap">        </span>ptr.memory = 4</div><div><span style="white-space:pre-wrap">        </span>ptr.memory = 5</div><div>}</div></blockquote><div><br></div><div>compiles to:</div><div><br></div><div><blockquote type="cite">define hidden void @_TF4test3fooFGVSs20UnsafeMutablePointerVSs5Int32_T_(i8* nocapture) #1 {<br>entry:<br>  %.value = bitcast i8* %0 to i32*<br>  store i32 5, i32* %.value, align 4<br>  ret void<br>}<br></blockquote><div><br></div><div>Notice how it&#39;s &quot;missing&quot; a store.</div><div>
<br><span style="color:rgb(0,0,0);font-family:&#39;Lucida Grande&#39;;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;display:inline!important;float:none">Félix</span>
</div>

<br><div><blockquote type="cite"><span class=""><div>Le 7 janv. 2016 à 15:54:36, Austin Zheng via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; a écrit :</div><br></span><div><div dir="ltr" style="font-family:LucidaGrande;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 class="">I&#39;d think the hypothetical way in Swift to write to configuration registers would be to create an UnsafeMutablePointer&lt;Int64&gt; (or some other raw integer type) from a raw memory address, and then get/set the contents using the &#39;memory&#39; property. Not sure if the compiler is &quot;smart&quot; enough to optimize out memory accesses made using that mechanism, although I would assume no.<div><br></div></span><div>Austin<br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Jan 7, 2016 at 3:52 AM, Romain Goyet via swift-evolution<span> </span><span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span><span> </span>wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><div dir="ltr"><div>Hi everyone,</div><div><br></div><div>In the<span> </span><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/" target="_blank">introduction to Swift</a>, it is presented as an &quot;industrial-quality systems programming language&quot;.</div><div>According to<span> </span><a href="https://en.wikipedia.org/wiki/System_programming_language" target="_blank">Wikipedia</a>, this means that I could expect to be able to write device drivers or operating systems in Swift.</div><div><br></div><div>However it seems like this claim is only partially true, since several important low-level features seem to be completely missing:</div><div><br></div><div>- Is it possible to generate<span> </span><a href="http://llvm.org/docs/LangRef.html#volatile-memory-accesses" target="_blank">volatile memory accesses</a><span> </span>in Swift? Writing device drivers is virtually impossible without a way to guarantee certain memory operations are actually made (and not optimized-out). </div><div><br></div><div>- Is it possible to embed raw binary data in Swift? For example, an equivalent of the following C code &quot;const int8_t foo[6] = {0x00,0x11,0x22,0x33,0x44,0x55};&quot;? The simple Swift equivalent, &quot;let foo: [Int8] = [0x0,0x1,0x2,0x3,0x4,0x6];&quot; is obviously wildly different. Being able to embed raw binary data is very important in a low-level environment: for example, you may need to feed specific data to a device for an initialization sequence at a point where you don&#39;t have a filesystem available yet.</div><div><br></div><div>There might be other aspects that I&#39;m overlooking right now, but I think that&#39;s enough to start a discussion: is Swift really meant to be a systems programming language?</div><div><br></div><div>Thanks,</div><div><br></div><div> - Romain</div></div><br></span><span class="">_______________________________________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br><br></span></blockquote></div><br></div></div></div><span class=""><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=iRI3beHTe3UxYAHTlV3lA38zIPfHMhyuRzgTmGKV6k6YOuVRWVtnThmgrhFLizcsV4JBVd2v1y6HehaxM2TU54eSdMPDBWkd2a6VECHeMKbH-2BRVFxVwIag5hxzV8TnRc1zxvlKXtGsS-2Be-2BxY0j52qJyet2wGfb-2FjHzamGf3iBTEThRnCGSeXFOeFAACZ1OqnRhqHYmDQKpcoV3RIv1z46Mv79cy-2FjIC-2BMsXCBQiCW2A-3D" alt="" width="1" height="1" border="0" style="font-family:LucidaGrande;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;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:LucidaGrande;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;float:none;display:inline!important"><span> </span>_______________________________________________</span><br style="font-family:LucidaGrande;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="font-family:LucidaGrande;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;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:LucidaGrande;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"><a href="mailto:swift-evolution@swift.org" style="font-family:LucidaGrande;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" target="_blank">swift-evolution@swift.org</a><br style="font-family:LucidaGrande;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"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:LucidaGrande;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" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span></div></blockquote></div><br></div></div></div></blockquote></div><br></div>