实现memcpy的问题

时间:2015-01-27 18:09:22

标签: rust

我正在处理使用libcoreno_std的项目,这需要实现各种内存操作函数。但是,当我尝试实现memcpy时,

#[no_mangle]
#[no_stack_check]
pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8{
    for i in 0..n {
        *dest.offset(i as isize) = *src.offset(i as isize);
    }
    return dest;
}

我得到了

error: expected ident, found `*`
*dest.offset(i as isize) = *src.offset(i as isize);
^

0 个答案:

没有答案