什么是我可以做一个64位的机器上这种结构的最小尺寸? [英] What is the smallest size I can make this structure on a 64bit machine?

查看:174
本文介绍了什么是我可以做一个64位的机器上这种结构的最小尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

typedef struct node{
    char one;
    char two;
    struct node *next;
} nodea;

我想在编译器填充方面,有没有什么办法,我可以做的sizeof(NODEA)小于16?

I'm thinking in terms of compiler padding, is there any way I can make the sizeof(nodea) smaller than 16?

推荐答案

您可以使用的#pragma包编译器指令<一个href=\"http://msdn.microsoft.com/en-us/library/2e70t5y1%28v=vs.80%29.aspx\">http://msdn.microsoft.com/en-us/library/2e70t5y1%28v=vs.80%29.aspx

 #pragma pack(push)
 #pragma pack(1)
 typedef struct node {
    char one;
    char two;
    struct node* next;
 } nodea;
 #pragma pack(pop)

这篇关于什么是我可以做一个64位的机器上这种结构的最小尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆