> On Nov 1, 2016, at 6:40 PM, Bernardo Breder via swift-users 
> <[email protected]> wrote:
> 
> Hello,
> 
> 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
> 
> For example, i can compile the code above at Xcode:
> 
> while true {
>     autoreleasepool {
>     var test: Data = "HTTP/1.1 200 OK\r\nContent-Length: 
> 1\r\n\r\na".data(using: .utf8)!
>     }
> }
> 
> But when i try to compile at Ubuntu:
> 
> git@breder:~$ cat main.swift     
> import Foundation
> 
> while true {
>     autoreleasepool {
>     var test: Data = "HTTP/1.1 200 OK\r\nContent-Length: 
> 1\r\n\r\na".data(using: .utf8)!
>     }
> }
> 
> git@breder:~$ swiftc main.swift 
> main.swift:4:5: error: use of unresolved identifier 'autoreleasepool'
>     autoreleasepool {
>     ^~~~~~~~~~~~~~~

Autoreleasepools are an ObjC compatibility feature. They aren't necessary in 
standalone Swift.

-Joe
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to