Nope. I use it with Metal buffers, for example :) Moreover, there's nothing inherently unsafe about sizeof, and I think it's important, *especially when you're working with UnsafePointers*, that safe things look safe. If the moment a pointer comes into the picture everything related to it is prefixed with Unsafe, that word loses its meaning entirely. On Thu, Jun 2, 2016 at 16:54 Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote:
> > I don't disagree with the points you make. But one can argue that this > is a good thing. It calls attention to code that requires extra attention > and care. In some ways this is similar to 'UnsafeMutablePointer<T>' vs > '*T'. Verbosity was a deliberate choice in that case. > > You know...rather than introducing a new type like MemoryLayout, would it > make sense to do this with static properties on UnsafePointer? > > UnsafePointer<Int>.pointeeSize > UnsafePointer<Int>.pointeeAlignment > UnsafePointer<Int>.pointeeSpacing > > If you need this information, 90% of the time you're probably using > UnsafePointer or one of its friends, right? > > -- > Brent Royal-Gordon > Architechies > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution