delphi 的结构体对齐关键字
Align fields (Delphi)
Go Up to Delphi Compiler Directives (List) Index
|
Type |
Switch |
|
Syntax |
{$A+}, {$A-}, {$A1}, {$A2}, {$A4}, {$A8} or {$A16} {$ALIGN ON}, {$ALIGN OFF}, {$ALIGN 1}, {$ALIGN 2}, {$ALIGN 4}, {$ALIGN 8} or {$ALIGN 16} |
|
Default |
{$A8} {$ALIGN 8} |
|
Scope |
Local |
Remarks
The $A directive controls the maximum alignment used by the compiler when introducing padding to align a field.
In the {$A1} or {$A-} state, fields are never aligned. All record and class structures are packed.
In the {$A2} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on word boundaries.
In the {$A4} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on doubleword boundaries.
In the {$A8} or {$A+} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on quadword boundaries.
In the {$A16} state, fields in record types that are declared without the packed modifier and fields in class structures are aligned on double quadword boundaries.
Record type field alignment is described in the Delphi Language Guide at Internal Data Formats (Delphi)#Record_Types.
Regardless of the state of the $A directive, variables and typed constants are always aligned for optimal access. In the {$A8} state, execution will be faster.
For OS X applications, stack alignment must be on 16-byte boundaries. For details, see Eli Boling's blog at http://blogs.embarcadero.com/eboling/2009/05/20/5607.
delphi 的结构体对齐关键字的更多相关文章
- 函数定义从零开始学C++之从C到C++(一):const与#define、结构体对齐、函数重载name mangling、new/delete 等
今天一直在学习函数定义之类的问题,下午正好有机会和大家共享一下. 一.bool 类型 逻辑型也称布尔型,其取值为true(逻辑真)和false(逻辑假),存储字节数在不同编译系统中可能有所不同,VC+ ...
- const与#define、结构体对齐、函数重载name mangling、new/delete 等
一.bool 类型 逻辑型也称布尔型,其取值为true(逻辑真)和false(逻辑假),存储字节数在不同编译系统中可能有所不同,VC++中为1个字节. 声明方式:bool result; result ...
- C语言结构体对齐
1.结构体变量中的元素如何访问? (1)数组中元素的访问方式:表面上有2种方式(数组下标方式和指针方式):实质上都是指针方式访问.(2)结构体变量中的元素访问方式:只有一种,用.或者->的方式来 ...
- 解析C语言结构体对齐(内存对齐问题)
C语言结构体对齐也是老生常谈的话题了.基本上是面试题的必考题.内容虽然很基础,但一不小心就会弄错.写出一个struct,然后sizeof,你会不会经常对结果感到奇怪?sizeof的结果往往都比你声明的 ...
- C语言基础--结构体对齐,位域,联合体
结构体对齐 1--结构体对齐的原因与意义 许多计算机系统对基本数据类型的可允许地址做出了一些限制,要求某种类型的对象的地址必须是某个值K(通常是2,4,8)的倍数,而这个k则被称为该数据类型的对齐模数 ...
- C语言中结构体对齐问题
C语言中结构体对齐问题 收藏 关于C语言中的结构体对齐问题 1,比如: struct{short a1;short a2;short a3;}A;struct{long a1;short a2;}B; ...
- 4-17疑难点 c语言之【结构体对齐】
今天学习了结构体这一章节,了解到了结构体在分配内存的时候采取的是对齐的方式 例如: #include<stdio.h> struct test1 { int a; char b; shor ...
- 结构体对齐及#pragma详细解释
在linux下c语言结构体对齐: 1.自然对齐 struct 是一种复合数据类型,其构成元素既可以是基本数据类型(如int.long.float 等)的变量,也可以是一些复合数据类型(如array.s ...
- C++学习之路(一):const与define,结构体对齐,new/delete
前言:针对C++ Primer和Effective C++两本书,以及技术博客与实验测试,本系列主要是针对C++进行系统化学习,记录学习中遇到的问题和经验. (一)const与define 关于con ...
随机推荐
- 面向对象的设计的SOLID原则
S.O.L.I.D是面向对象设计和编程中5个重要编码规则的首字母的缩写. - SRP The Single Responsibility Principle 单一责任原则 当需要修改某个类的时候原因有 ...
- centos7 搭建jenkins
centos7 搭建jenkins.note 环境:VMware 虚拟机 centos 7+ jdk 1.8+ tomcat7+jenkins搭建好linux 服务器后,关闭防火墙 停止firewal ...
- CAD交互绘制文字(网页版)
在CAD设计时,需要绘制文字,用户可以设置设置绘制文字的高度等属性. 主要用到函数说明: _DMxDrawX::DrawText 绘制一个单行文字.详细说明如下: 参数 说明 DOUBLE dPosX ...
- bonding的系统初始化介绍
bond0模块的加载 Bonding原理 为方便理解bonding的配置及实现,顺便阐述一下Linux的网络接口及其配置文件.在 Linux 中,所有的网络通讯都发生在软件接口与物理网络设备之间.与网 ...
- jQuery闪烁提示,让新消息在网页标题显示
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head& ...
- Day01:我的Python学习之路
1.Python是什么语言? Python是动态的解释性的强类型定义的语言. (1)动态语言与静态语言 ①静态语言:在编译期间就会去做数据类型检查的语言,如C,C++. ②动态语言:在运行期间才会去做 ...
- Floyd算法简单实现(C++)
图的最短路径问题主要包括三种算法: (1)Dijkstra (没有负权边的单源最短路径) (2)Floyed (多源最短路径) (3)Bellman (含有负权边的单源最短路径) 本文主要讲使用C++ ...
- phpstorm的全局操作快捷键ctrl+shift+f被搜狗占用处理方法
1.找到搜狗软件,右键选择属性设置 2.如图选择系统功能快捷键 3.去掉简繁切换快捷方式,确定后即可使用phpstorm的ctrl+shift+f来进行全局查找
- soc desgin 目前需要做的事情
1.熟练的画时序图 达到一旦有想法可以立即通过时序图表达出来. 2.下面是项目中经常用到的典型设计 2.1串并互相转换 2.2cdc 2.3握手协议 2.4cgc(门控时钟) 2.5AHB2reg文件 ...
- 自动化测试如何解析excel文件?
前言 自动化测试中我们存放数据无非是使用文件或者数据库,那么文件可以是csv,xlsx,xml,甚至是txt文件,通常excel文件往往是我们的首选,无论是编写测试用例还是存放测试数据,excel都是 ...