[swift-users] Using withUnsafePointer on char arrays within C structs

Quinn "The Eskimo!" eskimo1 at apple.com
Thu Feb 23 02:33:57 CST 2017


On 22 Feb 2017, at 22:16, Russell Finn via swift-users <swift-users at swift.org> wrote:

> … is (2) the best I can do for now?

Yes.

btw You can simplify the code to this:

    var description: String {
        var tmp = self.path
        return String(cString: &tmp.0)
    }

but it still needs that copy.

> And is this the sort of issue that the Ownership Manifesto is designed to address?

I’m not sufficiently up to speed on that topic to answer this.  Sorry.

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware




More information about the swift-users mailing list