@@ -6,6 +6,31 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
6
6
Swift 5.6
7
7
---------
8
8
9
+ * [ SE-0324] [ ] :
10
+
11
+ Relax diagnostics for pointer arguments to C functions. The Swift
12
+ compiler now accepts limited pointer type mismatches when directly
13
+ calling functions imported from C as long as the C language allows
14
+ those pointer types to alias. Consequently, any Swift
15
+ ` Unsafe[Mutable]Pointer<T> ` or ` Unsafe[Mutable]RawPointer ` may be
16
+ passed to C function arguments declared as `[ signed|unsigned] char
17
+ * ` . Swift ` Unsafe[ Mutable] Pointer<T >` can also be passed to C
18
+ function arguments with an integer type that differs from ` T ` only
19
+ in its signedness.
20
+
21
+ For example, after importing a C function declaration:
22
+ ``` c
23
+ long long decode_int64 (const char * ptr_to_int64);
24
+ ```
25
+ Swift can now directly pass a raw pointer as the function argument:
26
+ ```swift
27
+ func decodeAsInt64(data: Data) -> Int64 {
28
+ data.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
29
+ decode_int64(bytes.baseAddress!)
30
+ }
31
+ }
32
+ ```
33
+
9
34
* [ SE-0315] [ ] :
10
35
11
36
Type expressions and annotations can now include "type placeholders" which
@@ -8697,6 +8722,7 @@ Swift 1.0
8697
8722
[SE- 0313 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0313-actor-isolation-control.md>
8698
8723
[SE- 0315 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0315-placeholder-types.md>
8699
8724
[SE- 0316 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0316-global-actors.md>
8725
+ [SE- 0324 ]: < https: // github.com/apple/swift-evolution/blob/main/proposals/0324-c-lang-pointer-arg-conversion.md>
8700
8726
8701
8727
[SR- 75 ]: < https: // bugs.swift.org/browse/SR-75>
8702
8728
[SR- 106 ]: < https: // bugs.swift.org/browse/SR-106>
0 commit comments