> On Mar 1, 2017, at 7:08 PM, Kenny Leung via swift-users
> wrote:
>
> If it’s “making very few assumptions”, I would think that, for safety’s sake,
> functions that return a pointer would always be optional, forcing the user to
> deal with any possible null pointer returns.
>
Talking mysel
Hi Jordan.
Thanks for the lengthy answer.
> On Mar 1, 2017, at 6:21 PM, Jordan Rose wrote:
>
> Hey, Kenny. The const vs non-const part is important, since both the implicit
> conversion and cString(using:) are allowed to return a pointer to the
> internal data being used by the String, and mo
Ahh! thank you. That makes sense.
On Wed, Mar 1, 2017 at 3:29 PM, Guillaume Lessard <
gless...@tffenterprises.com> wrote:
>
> > On Mar 1, 2017, at 3:21 PM, Edward Connell via swift-users <
> swift-users@swift.org> wrote:
> >
> > The thread sanitizer on Linux is reporting that I have race conditio
> On Mar 1, 2017, at 14:23, Kenny Leung via swift-users
> wrote:
>
> Hi All.
>
> Swift automatically bridges String to char * when calling C functions. For
> instance, strlen gets translated as:
>
> public func strlen(_ __s: UnsafePointer!) -> UInt
>
> I can call it from Swift like this:
Your co-worker needs to get passed the learning curve of these “unsafe” APIs
and note that Swift arrays are complex data structures. &allZeros does not give
you a pointer to a bunch of zero bytes, but a pointer to a struct that contains
the private implementation details of allZeros array.
Her
> On Mar 1, 2017, at 3:21 PM, Edward Connell via swift-users
> wrote:
>
> The thread sanitizer on Linux is reporting that I have race conditions in
> libswiftcore. I eliminated enough code down to this trivial example. Is there
> really a race condition here or are these bogus errors?
>
>
on Wed Mar 01 2017, Edward Connell wrote:
> The thread sanitizer on Linux is reporting that I have race conditions in
> libswiftcore.
The only one we currently know about that's actually in libswiftcore is
the one addressed by https://github.com/apple/swift/pull/7183
> I eliminated enough cod
Thanks to Joe and Quinn for their answers. I have a related followup — a
co-worker learning Swift wrote the following function:
func allZerosUUID() -> String {
var allZeros = [UInt8](repeating: 0, count: 32)
return withUnsafePointer(to: &allZeros) { zerosPtr in
retu
Hi All.
Swift automatically bridges String to char * when calling C functions. For
instance, strlen gets translated as:
public func strlen(_ __s: UnsafePointer!) -> UInt
I can call it from Swift like this:
strlen("|")
I’m But, I’m working with a C struct containing a char *:
publ
The thread sanitizer on Linux is reporting that I have race conditions in
libswiftcore. I eliminated enough code down to this trivial example. Is
there really a race condition here or are these bogus errors?
let count = 1000
var items = [[UInt8]?](repeating: nil, count: count)
DispatchQueue.concu
10 matches
Mail list logo