When you need to implement removal of an element from an arraylist, don't use memcpy, use memmove. Your program might run fine on Windows but cause trouble in Linux, whose root cause would be hard to find.
memcpy() vs memmove(): in case of memcpy(), there is no extra buffer taken for source memory. The copying is done directly on the memory so that when there is memory overlap, we get unexpected results.
No comments:
Post a Comment