Re: [swift-users] Pointer conversions between different sockaddr types

2017-03-21 Thread Bouke Haarsma via swift-users
Hi all (again), It seems the fix is to (only) replace withUnsafePointer with withUnsafeMutablePointer twice. No need to apply the @escaping fixit even. -- Bouke On 2017-03-21 20:52:36 +, Bouke Haarsma via swift-users said: Hi Quinn, and others, I found that this code is still

Re: [swift-users] Pointer conversions between different sockaddr types

2017-03-21 Thread Bouke Haarsma via swift-users
Hi Quinn, and others, I found that this code is still featured on swift.org (https://swift.org/migration-guide/se-0107-migrate.html), but it doesn't compile anymore. There's a fix-it for adding @escaping, but also compile errors due to invalid casts. Can someone have a look at fixing this

Re: [swift-users] Pointer conversions between different sockaddr types

2016-08-22 Thread Quinn "The Eskimo!" via swift-users
On 18 Aug 2016, at 08:28, Quinn The Eskimo! via swift-users wrote: > In my case I introduced an abstract `Address` type (basically a wrapper > around `sockaddr_storage`) and then added a method to that object which calls > a closure with the right parameters (actually,

Re: [swift-users] Pointer conversions between different sockaddr types

2016-08-20 Thread Andrew Trick via swift-users
> On Aug 20, 2016, at 4:02 AM, Michael Ferenduros via swift-users > wrote: > >> >> On 20 Aug 2016, at 07:25, Andrew Trick > > wrote: >> >>> >>> On Aug 19, 2016, at 4:49 PM, Michael Ferenduros via swift-users >>>

Re: [swift-users] Pointer conversions between different sockaddr types

2016-08-19 Thread Andrew Trick via swift-users
> On Aug 19, 2016, at 4:49 PM, Michael Ferenduros via swift-users > wrote: > > >>> On Aug 18, 2016, at 12:28 AM, Quinn The Eskimo! via swift-users >>> wrote: >>> >>> >>> On 17 Aug 2016, at 18:55, Martin R via swift-users >> swift.org> wrote: >>> - Are both

Re: [swift-users] Pointer conversions between different sockaddr types

2016-08-19 Thread Michael Ferenduros via swift-users
> > On Aug 18, 2016, at 12:28 AM, Quinn The Eskimo! via swift-users > > wrote: > > > > > > On 17 Aug 2016, at 18:55, Martin R via swift-users > swift.org> wrote: > > > >> - Are both solutions correct, should one be preferred, or are both wrong? > > > > Your `withMemoryRebound` solution

Re: [swift-users] Pointer conversions between different sockaddr types

2016-08-19 Thread Michael Gottesman via swift-users
> On Aug 19, 2016, at 1:58 PM, Andrew Trick via swift-users > wrote: > > >> On Aug 18, 2016, at 12:28 AM, Quinn The Eskimo! via swift-users >> > wrote: >> >> >> On 17 Aug 2016, at 18:55, Martin R via swift-users

Re: [swift-users] Pointer conversions between different sockaddr types

2016-08-19 Thread Andrew Trick via swift-users
> On Aug 18, 2016, at 12:28 AM, Quinn The Eskimo! via swift-users > wrote: > > > On 17 Aug 2016, at 18:55, Martin R via swift-users > wrote: > >> - Are both solutions correct, should one be preferred, or are both wrong? > > Your

Re: [swift-users] Pointer conversions between different sockaddr types

2016-08-18 Thread Quinn "The Eskimo!" via swift-users
On 17 Aug 2016, at 18:55, Martin R via swift-users wrote: > - Are both solutions correct, should one be preferred, or are both wrong? Your `withMemoryRebound` solution is correct. > - Can the same be achieved simpler? Not without introducing a layer of abstraction.

[swift-users] Pointer conversions between different sockaddr types

2016-08-17 Thread Martin R via swift-users
I am trying to figure out how to work correctly with the new UnsafeRawPointer API (from https://github.com/apple/swift-evolution/blob/master/proposals/0107-unsaferawpointer.md ). Here my concrete example: The connect() system call takes a (const struct sockaddr *address) parameter, but one