Author: Dieter Buerssner
Date: 11:49:21 05/12/03
Go up one level in this thread
On May 12, 2003 at 14:43:00, Tom Kerrigan wrote: >On May 12, 2003 at 10:38:57, Fermin Serrano wrote: >> Question 3: >> ----------------- >> To copy a structure into other, what is faster, doing by copy each of his >>elements or use a memcpy? > >Use memcpy. It may not be faster on your system, but it's optimized on other >systems that you might use later. If you copy individual elements yourself, >there's no chance it will be optimized on any system. I don't agree. Use the assignment operator ("=")! It should never do worse than memcpy or copying individual members. On many compilers, it will make no difference (especially compilers that inline memcpy). I can see, that memcpy can produce worse code (depending on struct size). I really cannot see, that with any decent compiler the very obvious and clear assignment can produce worse code. Regards, Dieter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.