2012年4月7日

memcpy() 和 memmove() 有什么区别?

摘要: 如果源和目的参数有重叠, memmove()提供有保证的行为。而memcpy() 则不能提供这样的保证, 因此可以实现得更加有效率。如果有疑问, 最好使用memmove()。参考资料: [K&R2, Sec. B3 p. 250]; [ISO, Sec. 7.11.2.1, Sec. 7.11.2.2]; [Rationale, Sec. 4.11.2]; [H&S, Sec. 14.3 pp. 341-2]; [PCS, Sec. 11 pp. 165-6]。参考linux 内核实现:memcpy:/***memcpy-Copyoneareaofmemorytoanother 阅读全文

posted @ 2012-04-07 10:37 linzuxin 阅读(280) 评论(0) 推荐(0) 编辑

导航