pointer arithmetic is possible in Nim, but you should reeaaaally use them only 
for FFI and not in your daily.

Since int has the size of a pointer in Nim, you can do this: 
    
    
    copyMem(cast[ptr UDP_packet](cast[int](addr t)+sizeof(UDP_packet)),addr 
my_str[0], my_str.len)
    
    
    Run

Though you really shouldn't do this, unless there's no way around it.

You might be interested in 
[UncheckedArray](https://nim-lang.org/docs/system.html#UncheckedArray) s, since 
they can often replace pointer arithmetic with something far safer(but still 
not safe).

Reply via email to