The `pointer` type doesn't have a `+` proc out-of-the-box (to prevent common 
pointer arithmetic mistakes, iirc). So you need to cast each pointer to an int, 
do the arithmetic on those, then cast the result back into a pointer.

Off the top of my head.. 
    
    
    all = cast[pointer](
      cast[int](vert) +
      cast[int](face) +
      cast[int](nrml) +
      cast[int](tex)
    )
    

You could define a `+` operator for pointers yourself to make this easier if 
you use it a lot. Also, you should consider using `create` & `resize` as 
alternatives to `alloc` & `dealloc`. Same thing, but they're type-safe and 
result in cleaner code.

All that said, using an `{.unchecked.}` array might make your life easier in 
general.. depending how much you're accessing individual items in these arrays. 
You can see an example of it 
[here](https://gist.github.com/PhilipWitte/b4c8188287175cf99338)

Reply via email to