我正在开发一个iphone应用程序,当我编译它时,我收到一些警告。该应用程序的工作原理,但可能删除所有警告不是很有趣吗?NSAllocateCollectable它可能与iPhone应用程序?
这是其中之一,我不能低估,基本上是因为我是一个iPhone SDK的“新手”,这个类来自另一个代码(免费代码)。
警告是:
警告:的功能隐式声明 'NSAllocateCollectable' 警告:初始化时将整数指针,未作铸造
的代码是这样的:
double *MatrixAllocateArray(NSUInteger rows, NSUInteger columns)
{
// Allocate an array to hold [rows][columns] matrix values
NSCParameterAssert(rows!=0);
NSCParameterAssert(columns!=0);
__strong double *array = NSAllocateCollectable(SIZEOFARRAY(rows,columns),0); //(WARNINGS APPEAR HERE)
NSCAssert2(array!=NULL,@"falled to allocate %dx%d matrix",rows,columns);
return array;
}
正如你可以看到这个函数试图分配一个矩阵,它被另一个函数调用。
double *MatrixAllocateEmptyArray(NSUInteger rows, NSUInteger columns)
{
// Allocate a matrix array and fill it with zeros
__strong double *emptyArray = MatrixAllocateArray(rows,columns);
bzero(emptyArray,SIZEOFARRAY(rows,columns));
return emptyArray;
}
,这是由我执行的功能和需要调用:
- (id)initWithRows:(NSUInteger)rowCount columns:(NSUInteger)colCount
{
// Create an empty matrix
return [self initWithAllocatedArray:MatrixAllocateEmptyArray(rowCount,colCount)
rows:rowCount
columns:colCount];
}