We should provide a guarantee of pointer stability not just within the `withUnsafePointer` closure, but also with across multiple calls with `withUnsafePointer`, `@inout` arguments, and C functions that access the same global.
The implementation should guarantee that the pointer passed to `takePointer` is the address of `myGlobal`:
$0 == &myGlobal
I think this rule should apply to globals and class properties. @lorentey also proposed a "stable storage" language extension, so there might be some overlap with that.
The text was updated successfully, but these errors were encountered:
atrick commentedJul 8, 2020
Additional Detail from JIRA
md5: f898da4d21aaa0b9abd17b57883351ec
Issue Description:
We should provide a guarantee of pointer stability not just within the `withUnsafePointer` closure, but also with across multiple calls with `withUnsafePointer`, `@inout` arguments, and C functions that access the same global.
For example:
C code:
Swift code
The implementation should guarantee that the pointer passed to `takePointer` is the address of `myGlobal`:
I think this rule should apply to globals and class properties. @lorentey also proposed a "stable storage" language extension, so there might be some overlap with that.
The text was updated successfully, but these errors were encountered: