Hi all,
I have some news on the WWDC meet-up that was announced earlier this week.
Thanks to the help of a friendly community member, Bert Belder, we have been
able to secure a very cool venue!
The meetup will take place on Tuesday, June 14th at 7pm, in the IBM Bluemix
Garage, which is at abo
> On Jun 9, 2016, at 8:39 PM, Saagar Jha via swift-users
> wrote:
>
> Nevermind, I lied. Swift does allow direct pointer arithmetic:
>
> import Foundation
>
> var source = [UInt8](repeating: 0x1f, count: 32)
> var destination = [UInt8](repeating: 0, count: 64)
>
> memcpy(&destination, source
Nevermind, I lied. Swift does allow direct pointer arithmetic:
import Foundation
var source = [UInt8](repeating: 0x1f, count: 32)
var destination = [UInt8](repeating: 0, count: 64)
memcpy(&destination, source, 32) // the C function
memcpy(&destination + 3, source, 13) // the + operator works to
Swift handling of Arrays isn’t like C (for which you can use UnsafePointer)-you
don’t access the pointer of the third element. Instead, you can use Array
slices, which makes it a one liner:
destination[destinationStartIndex.. wrote:
> I am converting a very dirty C program to Swift3, and their is
I am converting a very dirty C program to Swift3, and their is plenty of
pointer arithmetic to be dealt with. As part of the effort, I have
created a 'memcpy clone to help with some of the transformation.
Here is the output from the REPL:
1. var source = [UInt
Swift generics are not like C++ templates; they are built on dynamic dispatch
at runtime instead of instantiation, much like Java interfaces. Overload
resolution, on the other hand, happens at compile-time, with "more specific”
overloads being preferred over “less specific” ones. (The exact orde
Hi Ian,
You're right, if there's a function that's specialized everything works well
(actually, I deleted exactly the same function from my example, in an attempt
to be brief and succinct :) ). But that kind of ruins the whole point of
interface specialization and violates the principle of leas