Skip to content

Commit 80093fe

Browse files
Update docs/HowSwiftImportsCAPIs.md
1 parent 1331ac5 commit 80093fe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/HowSwiftImportsCAPIs.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ void drawStringRenamed(const char *, int xPos, int yPos)
315315
```swift
316316
// C header imported in Swift.
317317
318-
func drawString(_: UnsafePointer<CChar>!, _ xPos: Int, _ yPos: Int)
319-
func drawStringRenamed(_: UnsafePointer<CChar>!, x: Int, y: Int)
318+
func drawString(_: UnsafePointer<CChar>!, _ xPos: CInt, _ yPos: CInt)
319+
func drawStringRenamed(_: UnsafePointer<CChar>!, x: CInt, y: CInt)
320320
321321
drawString("hello", 10, 20)
322322
drawStringRenamed("hello", x: 10, y: 20)
@@ -602,9 +602,9 @@ memory layout.
602602

603603
As discussed above, there are cases where bridging that adjusts memory layout is
604604
not possible, for example, when importing pointers to function pointers. For
605-
example, while C's int `(*)(char)` can be imported as `(Int8) -> Int` (requires
605+
example, while C's `int (*)(char)` can be imported as `(CChar) -> CInt` (requires
606606
an adjustment of memory layout), C's `int (**)(char)` can't be imported as
607-
`UnsafePointer<(Int8) -> Int>`, because the pointee must have identical memory
607+
`UnsafePointer<(CChar) -> CInt>`, because the pointee must have identical memory
608608
layout in C and in Swift.
609609

610610
Therefore, we need a Swift type that has a memory layout identical to C function
@@ -800,9 +800,9 @@ union IntOrFloat {
800800

801801
struct IntOrFloat {
802802
var i: CInt { get set } // Computed property.
803-
var f: Float { get set } // Computed property.
803+
var f: CFloat { get set } // Computed property.
804804
init(i: CInt)
805-
init(f: Float)
805+
init(f: CFloat)
806806
init()
807807
}
808808
```

0 commit comments

Comments
 (0)