Sony Electronics interview question

implement your version of memcpy()

Interview Answers

Anonymous

19 Mar 2009

what the interviewee's really wanted to know was your thought process in descrption the implementation, as your write, say what you are thinking in order to get a conversation going w/ the audience. In my case, we ended up on a whole tangent about what if the memory you are trying to copy is already occupied, which led to memmove() which ultimately sparked a conversation among the group, i.e. a more positive engagement versus just going up to the whiteboard in silence.

Anonymous

29 May 2009

It might be good to mention that getting aligned onto native word boundaries and then using the largest native word size for the machine in question to do the transfer would be a good optimization. All real implementations do this. You would have to discuss the edge cases of source vs. dest alignment and dealing with the odd bytes left over.