<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">It is. This:<div class=""><br class=""></div><div class=""><div class=""></div><blockquote type="cite" class=""><div class="">func foo(ptr: UnsafeMutablePointer&lt;Int32&gt;) {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>ptr.memory = 4</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>ptr.memory = 5</div><div class="">}</div></blockquote><div class=""><br class=""></div><div class="">compiles to:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">define hidden void @_TF4test3fooFGVSs20UnsafeMutablePointerVSs5Int32_T_(i8* nocapture) #1 {<br class="">entry:<br class="">&nbsp;&nbsp;%.value = bitcast i8* %0 to i32*<br class="">&nbsp;&nbsp;store i32 5, i32* %.value, align 4<br class="">&nbsp;&nbsp;ret void<br class="">}<br class=""></blockquote><div class=""><br class="webkit-block-placeholder"></div><div class="">Notice how it's "missing" a store.</div><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class="">Félix</span>
</div>

<br class=""><div><blockquote type="cite" class=""><div class="">Le 7 janv. 2016 à 15:54:36, Austin Zheng via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I'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 'memory' property. Not sure if the compiler is "smart" enough to optimize out memory accesses made using that mechanism, although I would assume no.<div class=""><br class=""></div><div class="">Austin<br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jan 7, 2016 at 3:52 AM, Romain Goyet via swift-evolution<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><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;"><div dir="ltr" class=""><div class="">Hi everyone,</div><div class=""><br class=""></div><div class="">In the<span class="Apple-converted-space">&nbsp;</span><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/" target="_blank" class="">introduction to Swift</a>, it is presented as an "industrial-quality systems programming language".</div><div class="">According to<span class="Apple-converted-space">&nbsp;</span><a href="https://en.wikipedia.org/wiki/System_programming_language" target="_blank" class="">Wikipedia</a>, this means that I could expect to be able to write device drivers or operating systems in Swift.</div><div class=""><br class=""></div><div class="">However it seems like this claim is only partially true, since several important low-level features seem to be completely missing:</div><div class=""><br class=""></div><div class="">- Is it possible to generate<span class="Apple-converted-space">&nbsp;</span><a href="http://llvm.org/docs/LangRef.html#volatile-memory-accesses" target="_blank" class="">volatile memory accesses</a><span class="Apple-converted-space">&nbsp;</span>in Swift? Writing device drivers is virtually impossible without a way to guarantee certain memory operations are actually made (and not optimized-out).&nbsp;</div><div class=""><br class=""></div><div class="">- Is it possible to embed raw binary data in Swift? For example, an equivalent of the following C code "const int8_t foo[6] = {0x00,0x11,0x22,0x33,0x44,0x55};"? The simple Swift equivalent, "let foo: [Int8] = [0x0,0x1,0x2,0x3,0x4,0x6];" 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't have a filesystem available yet.</div><div class=""><br class=""></div><div class="">There might be other aspects that I'm overlooking right now, but I think that's enough to start a discussion: is Swift really meant to be a systems programming language?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">&nbsp;- Romain</div></div><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div><br class=""></div></div></div><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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; height: 1px !important; width: 1px !important; border-width: 0px !important; margin: 0px !important; padding: 0px !important;" class=""><span style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><span class="Apple-converted-space">&nbsp;</span>_______________________________________________</span><br style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: LucidaGrande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></div></body></html>