Re:How a language can be faster than C
by mynegation on Sunday March 25, 2012 @09:36AM
(#3752553)
A nitpick: memcpy example is flawed: memcpy's behavior is undefined if source and destination overlap. One should use memmove for that.
[ Parent
| on HN ]
Re:How a language can be faster than C
by pascal_cuoq on Sunday March 25, 2012 @09:46AM
(#3752577)
This was my initial reaction, but he is talking about a function that happens to be named memcpy() and what the compiler is allowed to do with the provided source code. So you should actually blame him for defining a function with the same name as a standard function (an undefined behavior). What would make his example correct is to use any name other than a reserved one, that is, not "memmove".
If you look more closely, he actually called it "memcopy", not "memcpy".
Re:How a language can be faster than C
by faithful_droog on Sunday March 25, 2012 @07:10PM
(#3754172)
If you look more closely, you will also see that his memcopy dereferences a void * (and performs some pointer arithmetic as well). Apologies for my inner pedant getting the better of me.