|
|
|
|
|
by raverbashing
3695 days ago
|
|
> Then, developers write code that depends on those guarantees and fails to meet the preconditions, but happens to work anyway. This reminds me of the memcpy/memmove issue. You should use "move" when areas overlap, not memcpy The real question is: why are there two versions? Checking if the memory overlap is very cheap compared to copying, let's say 16 elements. And if you're memcpy'ing smaller sizes you can probably do it manually > I know C and C++ can be a royal pain in the ass sometime Yes, they lack enough information to know what you are actually trying to do and have to guess a lot of things. Not sure how "C++ smart" are modern compilers. (Example: you pass an object by value, and only read one field, can it optimize this?) |
|
Yes.
compiles the baz function to (-O2 on GCC 4.9)