4 ms·
What exactly do you mean "call down into C"? You should be able to call C functions directly from Swift, albeit with UnsafePointer and the like.
by saagarjha 9y ago
What exactly do you mean "call down into C"? You should be able to call C functions directly from Swift, albeit with UnsafePointer and the like.
- ainar-g 9y agoI assume, they mean that you don't need to have C at all. See how Go for example doesn't require C on most platforms to make syscalls (IIRC, the exceptions are Windows and Solaris).
- saagarjha 9y agoSo, based on this[1] they've just wrapped the calls with their own…not sure if there are any real benefits here. [1]: https://golang.org/src/syscall/syscall_linux.go https://golang.org/src/syscall/syscall_linux.go
- brutus1213 9y agoI've been using Swift for a few months and really want to like it. That said, breaking down to unsafepointer for newbie tasks is unacceptable IMHO. Try to do basic stuff like TCP/IP socket coms without a third party library or heck, just get the IPv4 address of your network interface.