About Swift and Relax diagnostics for pointer arguments to C functions (SE-0324).

In my opinion, SE-0324 is often overlooked or underestimated. But it significantly simplifies working with the C API thanks to implicit pointer conversions. For example, it's acceptable in many cases to pass an argument of type 'UnsafeRawPointer' to a C function. Before SE-0324, we were required to use 'assumingMemoryBound(to:)' (see example below).

Post continues below.

#swift

... In the example, an implicit conversion occurs from 'UnsafeRawPointer?' to 'UnsafePointer<CChar>!', so 'assumingMemoryBound(to:)' can be removed and the code can be simplified to three clear lines.

The list of all possible conversions: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0324-c-lang-pointer-arg-conversion.md#detailed-design

#swift

swift-evolution/proposals/0324-c-lang-pointer-arg-conversion.md at main · swiftlang/swift-evolution

This maintains proposals for changes and user-visible enhancements to the Swift Programming Language. - swiftlang/swift-evolution

GitHub