33,311
社区成员
发帖
与我相关
我的任务
分享
template<typename T>
void print_stack_size(char *name)
{
printf("struct %s's size=%dbytes",name,sizeof(T));
}
typedef struct tagTest
{
int i;
int j:4;
int k:4;
}TEST;
print_stack_size <TEST> ("TEST");
template <typename T>
void print_stack_size(char *name)
{
printf("struct %s's size=%dbytes",name,sizeof(T));
}
type tagTest
{
int i;
BYTE j:4;
BYTE k:4;
}TEST;
print_stack_size <TEST> ("TEST");
#include <stdio.h>
#define print_size(type) \
do \
{ \
printf("The size of '" #type "' is %d.\n", sizeof(type)); \
} while (0)
void main(void)
{
print_size(int);
}