In writing my blog series (Blog series: The Swift Runtime), I want to cite when I'm relying on a property that I and others have talked about before: the inout-to-pointer conversion for a stored global will always use the actual address of the global instead of making a local copy. This guarantee is only provided for globals and static stored properties right now, and even then only in modules compiled without library evolution support (plus non-
const globals imported from C, of course).
I know we want to do better here, with @lorentey and others having mentioned a hypothetical "addressable" attribute that could be applied to class instance properties (and elsewhere?), and the previous thread "Passing an extern const C struct by pointer possible?". However, right now I'm just looking for a citation (Apple or swift.org docs, WWDC presentation, compiler docs) of the guarantee I stated above.
Here's the earliest forum post I can find (from me, actually):
But that's not really a good citation in the same way as "Guarantee (in-memory) tuple layout…or don't" doesn't have a good citation. Anyone know of something better?
(see also The state of Swift documentation :-( )