From what I understand, & works with the inout keyword by copying the value both ways. However it also seems to work for functions that take one of the UnsafePointer types as an argument. Can I assume it’s passing an actual pointer in this case, or is that going to cause issues?
For C functions only, & passes a pointer to the value. I believe the compiler warns if you use & to pass an inout argument to a native Swift function that takes a pointer.
inout guarantees exclusive storage, which is needed because C functions that take pointer arguments often expect to be able to write to memory through the pointer, and those mutations would be lost if we passed a copy of x instead of x itself.
Aha, I just found a relevant thread. It seems I was misremembering, or perhaps remembering a proposal buried in that thread or a conversation I’d had elsewhere.