Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I remembered the return value incorrectly. It's even better in that it returns a pointer to the byte immediately AFTER the last written. So remove the - 1. PS: there's also a version which works with wchar_t types (be it 2, 4 or whatever else)

  #DEFINE mempcpy(X, Y, Z) (void *)(memcpy(X, Y, Z) + Z)
  #DEFINE wmempcpy(X, Y, Z) (void *)(memcpy(X, Y, Z * sizeof(wchar_t)) + Z * sizeof(wchar_t))


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: