【发布时间】:2009-10-26 18:12:26
【问题描述】:
如何以符合 (ISO C99) 的方式执行以下操作?
#define MALLOC(type, length, message) ({ \
type * a_##__LINE__ = (type *)malloc((length) * sizeof(type)); \
assert(message && (a_##__LINE__ != NULL)); \
a_##__LINE__; \
})
double **matrix = MALLOC(double *, height, "Failed to reserve");
注意:编译我使用:gcc -std=c99 -pedantic ...
【问题讨论】: