[swift-evolution] [Pitch] Remove transparent bridging between Swift strings and char *
Kenny Leung
kenny_leung at pobox.com
Wed Jun 22 11:37:46 CDT 2016
Hi All.
In the spirit of Chris’ focus on Swift 3 message…
I’ve been working on calling C code that takes “const char * const *” arguments, and it ain’t easy, but that can be left for a future proposal…
What does surprise me is that Swift String bridges directly into “char *” arguments in C as nul-terminated C strings, apparently preserving unicode and all. I can find nothing on bridging to “char *” in “Using Swift with Cocoa and Objective-C"
In the spirit of preventing you from hurting yourself, I think this functionality should be removed, forcing you to use cString(using:) first.
-Kenny
More information about the swift-evolution
mailing list