[swift-evolution] [Pitch] Renaming sizeof, sizeofValue, strideof,	strideofValue
    Brent Royal-Gordon 
    brent at architechies.com
       
    Fri Jun  3 07:08:35 CDT 2016
    
    
  
> This might be silly, but what if there were a struct with all of the relevant fields (not sure what the best name would be):
> 
> struct MemoryLayout {
>  let size: Int
>  let alignment: Int
>  let stride: Int
> // etc
> }
> 
> Then you’d only maybe need two functions:
> 
> memoryLayout(of:) and memoryLayout(ofType:)
Could the `memoryLayout` functions just return `(size: Int, alignment: Int, spacing: Int)` tuples? It's hard to tell because it goes into Builtin land, but I get the impression that these values are calculated at compile time anyway, and if you only used one of them the optimizer could throw the others away.
-- 
Brent Royal-Gordon
Architechies
    
    
More information about the swift-evolution
mailing list