[swift-evolution] [Pitch] Renaming sizeof, sizeofValue, strideof, strideofValue

Brent Royal-Gordon brent at architechies.com
Thu Jun 2 16:55:08 CDT 2016


> 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



More information about the swift-evolution mailing list