Liste des Groupes | Revenir à c arch |
On Wed, 4 Sep 2024 17:53:13 +0000, David Brown wrote:
On 04/09/2024 18:07, Tim Rentsch wrote:
Or just use memmove, and not memcpy, whenever you are moving stuff around in the same buffer.Memmove() is always appropriate unless you are doing somethingIf all the records are in one large array, there is a simple>
test to see if memcpy() must work or whether some alternative
should be used instead.
Such tests are usually built into implementations of memmove(), which
will chose to run forwards or backwards as needed. So you might as well
just call memmove() any time you are not sure memcpy() is safe and
appropriate.
nefarious.
So:
# define memcpy memomve
and move forward with life--for the 2 extra cycles memmove costs it
saves everyone long term grief.
When you need the nefarious activities of memcpy write it as amemcpy is not nefarious. It's quite simple, and does what it says on the tin. Use it when you want to copy non-overlapping memory areas. Don't use it if you want to do something other than that. I have never understood why anyone would find this difficult.
for loop by yourself and comment the nafariousness of the use.
Les messages affichés proviennent d'usenet.