本文介绍了memmove是否将动态内存用于其临时数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据 C11 N1570标准草案:
7.24.2.2"memmove
函数":
7.24.2.2 "The memmove
function":
因此,如果我选择使用(file_size = 32K)移动大小为32K的缓冲区
So if I choose to move a buffer of size 32K using (file_size = 32K)
memmove(io_Buffer, io_Buffer+17, file_size);
临时缓冲区的大小不是32K吗?
won't the temp buffer be of size 32K?
问题
程序可以自行分配动态内存吗?它会在那一行中分配和释放内存吗?
Can the program allocate dynamic memory on its own? Does it allocate and free the memory in that one line?
推荐答案
我认为您错过了该句子中的好像".这意味着效果将与执行此操作相同,而不是实际上执行该操作.我从未见过真正使用临时数组的memmove
实现.
I think you missed the "as if" in that sentence. That means the effects will be the same as if it did that, not that it will actually do that. I've never seen an implementation of memmove
that actually uses a temporary array.
这篇关于memmove是否将动态内存用于其临时数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!