我对代码行有疑问
memset(&array->objects[array->count] & memmove(&array->objects[objectIndex + 1UL]
这是信息的全部代码:
if(!((array != NULL) && (array->objects != NULL) && (objectIndex <= array->count) && (newObject != NULL))) { [newObject autorelease]; return; }
if((array->count + 1UL) >= array->capacity) {
id *newObjects = NULL;
if((newObjects = (id *)realloc(array->objects, sizeof(id) * (array->capacity + 16UL))) == NULL) { [NSException raise:NSMallocException format:@"Unable to resize objects array."]; }
array->objects = *newObjects;
array->capacity += 16UL;
memset(&array->objects[array->count], 0, sizeof(id) * (array->capacity - array->count));
}
array->count++;
if((objectIndex + 1UL) < array->count) { memmove(&array->objects[objectIndex + 1UL], &array->objects[objectIndex], sizeof(id) * ((array->count - 1UL) - objectIndex)); array->objects[objectIndex] = NULL; }
array->objects[objectIndex] = newObject;
我真的不知道这个问题...
谢谢。
答案 0 :(得分:0)
似乎在抱怨您试图获取指向作为类属性的对象的地址指针。在某种程度上,Objective C会尽量避免使用其属性和对象来避免使用C语言。我建议将数据从您的对象复制到某种类型的C结构中,然后使用该结构进行复制。