64,647
社区成员
发帖
与我相关
我的任务
分享
enum {__ALIGN = 8}; //上调边界
enum {__MAX_BYTES =128}; //小型区块的上限
enum {__NFREELISTS = __MAX_BYTES/__ALIGN}; //free_lists 个数
//第二级配置器
template<bool threads, int inst>
class __default_alloc_template
{
private:
//节点结构
union obj
{
union obj * free_list_link;
char client_data[1];
};
private:
static obj* volatile free_list[__NFREELISTS];
};
//在这里编译不过,vc2010
template<bool threads,int inst>
__default_alloc_template<threads,inst>::obj* volatile
__default_alloc_template<threads.inst>::free_list[__NFREELISTS]=
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
error C1903: unable to recover from previous error(s); stopping compilation
error C2143: syntax error : missing ';' before '*'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
template<bool threads,int inst>
__default_alloc_template<threads,inst>::obj* volatile
free_list[__NFREELISTS]=
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};