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 的结构体对齐关键字的更多相关文章

  1. 函数定义从零开始学C++之从C到C++(一):const与#define、结构体对齐、函数重载name mangling、new/delete 等

    今天一直在学习函数定义之类的问题,下午正好有机会和大家共享一下. 一.bool 类型 逻辑型也称布尔型,其取值为true(逻辑真)和false(逻辑假),存储字节数在不同编译系统中可能有所不同,VC+ ...

  2. const与#define、结构体对齐、函数重载name mangling、new/delete 等

    一.bool 类型 逻辑型也称布尔型,其取值为true(逻辑真)和false(逻辑假),存储字节数在不同编译系统中可能有所不同,VC++中为1个字节. 声明方式:bool result; result ...

  3. C语言结构体对齐

    1.结构体变量中的元素如何访问? (1)数组中元素的访问方式:表面上有2种方式(数组下标方式和指针方式):实质上都是指针方式访问.(2)结构体变量中的元素访问方式:只有一种,用.或者->的方式来 ...

  4. 解析C语言结构体对齐(内存对齐问题)

    C语言结构体对齐也是老生常谈的话题了.基本上是面试题的必考题.内容虽然很基础,但一不小心就会弄错.写出一个struct,然后sizeof,你会不会经常对结果感到奇怪?sizeof的结果往往都比你声明的 ...

  5. C语言基础--结构体对齐,位域,联合体

    结构体对齐 1--结构体对齐的原因与意义 许多计算机系统对基本数据类型的可允许地址做出了一些限制,要求某种类型的对象的地址必须是某个值K(通常是2,4,8)的倍数,而这个k则被称为该数据类型的对齐模数 ...

  6. C语言中结构体对齐问题

    C语言中结构体对齐问题 收藏 关于C语言中的结构体对齐问题 1,比如: struct{short a1;short a2;short a3;}A;struct{long a1;short a2;}B; ...

  7. 4-17疑难点 c语言之【结构体对齐】

    今天学习了结构体这一章节,了解到了结构体在分配内存的时候采取的是对齐的方式 例如: #include<stdio.h> struct test1 { int a; char b; shor ...

  8. 结构体对齐及#pragma详细解释

    在linux下c语言结构体对齐: 1.自然对齐 struct 是一种复合数据类型,其构成元素既可以是基本数据类型(如int.long.float 等)的变量,也可以是一些复合数据类型(如array.s ...

  9. C++学习之路(一):const与define,结构体对齐,new/delete

    前言:针对C++ Primer和Effective C++两本书,以及技术博客与实验测试,本系列主要是针对C++进行系统化学习,记录学习中遇到的问题和经验. (一)const与define 关于con ...

随机推荐

  1. Metinfo 5.3.19管理员密码重置漏洞复现

     Metinfo 5.3.19管理员密码重置漏洞 操作系统:Windows 10专业版   kali linux  网站环境:UPUPW 5.3 使用工具:burpsuite 1.7 beta 漏洞分 ...

  2. qobject_cast

    void QLadderDiagramItem::GetMainForm(DoType sourceType){ for each (QWidget *w in qApp->topLevelWi ...

  3. 前端拖动div 效果

    /** * author levi * url http://levi.cg.am */ $(function() { $(document).mousemove(function(e) { if(! ...

  4. js检测对象是否是数组

    js检测对象是否是数组 可以通过instanceof 方法一. var arr=[] arr instanceof Array   //true var obj={} obj instanceof A ...

  5. Beego:原生方式使用MySQL

    示例: package controllers import ( "database/sql" "fmt" "github.com/astaxie/b ...

  6. POJ 2631 Roads in the North (求树的直径)

    Description Building and maintaining roads among communities in the far North is an expensive busine ...

  7. ubuntu安装远程桌面连接工具

    1. 安装xrdp sudo apt-get -y install xrdp   2.安装vnc4server sudo apt-get install vnc4server   3.安装xubunt ...

  8. Java 新手学习日记一

    Java 基础知识点掌握: 数据类型 变量就是申请内存来存储值.也就是说,当创建变量的时候,需要在内存中申请空间.内存管理系统根据变量的类型为变量分配存储空间,分配的空间只能用来储存该类型数据. 因此 ...

  9. BeautifulSoup4系列一

    前言 以博客园为例,爬取我的博客上首页的发布时间.标题.摘要,本篇先小试牛刀,先了解下它的强大之处,后面讲beautifulsoup4的详细功能. 一.安装 1.打开cmd用pip在线安装beauti ...

  10. Ext.js双击事件

    /** * 联系人列表panel */ Ext.define('Op.OpBill.OpBillCustLinkGridPanel', { extend: 'Ext.grid.Panel', id: ...