<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 2, 2016, at 09:42, Joe Groff via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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=""><br class="Apple-interchange-newline">On Nov 1, 2016, at 6:40 PM, Bernardo Breder via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:<br class=""><br class="">Hello,<br class=""><br class="">I want to create a mini http server project and execute at Ubuntu 15. The Xcode compile and access the function "autoreleasepool", but when i compile the same code at Ubuntu, this function not found<br class=""><br class="">For example, i can compile the code above at Xcode:<br class=""><br class="">while true {<br class=""> autoreleasepool {<br class=""> var test: Data = "HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\na".data(using: .utf8)!<br class=""> }<br class="">}<br class=""><br class="">But when i try to compile at Ubuntu:<br class=""><br class="">git@breder:~$ cat main.swift <br class="">import Foundation<br class=""><br class="">while true {<br class=""> autoreleasepool {<br class=""> var test: Data = "HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\na".data(using: .utf8)!<br class=""> }<br class="">}<br class=""><br class="">git@breder:~$ swiftc main.swift<span class="Apple-converted-space"> </span><br class="">main.swift:4:5: error: use of unresolved identifier 'autoreleasepool'<br class=""> autoreleasepool {<br class=""> ^~~~~~~~~~~~~~~<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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="">Autoreleasepools are an ObjC compatibility feature. They aren't necessary in standalone Swift.</span></div></blockquote><br class=""></div><div>But they <i class="">are</i> necessary in Swift programs on Apple platforms (that don’t use RunLoop, anyway). Philippe, what do you think? What’s the right way to write cross-platform code that doesn’t use RunLoop or dispatch_main for an implicit autorelease pool?</div><div><br class=""></div><div>(/me remembers +[NSAutoreleasePool drain] from the ObjC-GC days)</div><br class=""><div class="">Jordan</div></body></html>