[swift-evolution] [Pitch] Renaming sizeof, sizeofValue, strideof, strideofValue
Xiaodi Wu
xiaodi.wu at gmail.com
Thu Jun 2 17:01:00 CDT 2016
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 at 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 at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160602/a0964b4f/attachment.html>
More information about the swift-evolution
mailing list