当前位置:网站首页>assert _ Aligns
assert _ Aligns
2022-07-26 02:29:00 【Virgo programmer's friend】
macro assert The definition of depends on the standard library and does not define another macro NDEBUG.
if NDEBUG It contains <assert.h> The point in the source code of is defined as macro name , be assert Not doing anything .
If not defined NDEBUG, be assert Set its parameters ( Must have scalar type ) Equal to zero comparison , If equal , be assert Output the specified diagnostic information on the standard error output , And call abort. Diagnostic information requires text containing expressions , And standard macros _FILE_、_LINE_ And predefined variables _func_ Value .
Parameters
condition -- Scalar type expression
Return value
( nothing )
Example :
#include<stdio.h>
#include<assert.h>
#include<math.h>
int main(void)
{
double x = -1.0;
assert(x>=0.0);
printf("sqrt(x) = %f\n",sqrt(x));
return 0;
}
_Aligns
Appears in declarative syntax , As a specifier for modifying the alignment requirements of declaration objects .
expression : Any integer constant expression whose value is legally aligned or zero .
type : Any type name
_Aligns You can only declare that it is not a bit field , And does not have a register storage class . It cannot be used for function parameter declarations , Not for typedef. When used for declaration . Set the alignment requirements of the declared object to :
1) Result of expression , Unless it is zero .
2) Alignment requirements for types , It is set to _Alignof(type)
Example :
#include<stdalign.h>
#include<stdio.h>
// every last struct sse_t Objects of type will be in 16 Byte boundary alignment .
struct sse_t
{
aligns(16) float sse_data[4];
};
// such struct data Every object of will be in 128 Byte boundary alignment
struct data{
char x;
alignas(128) char cacheline[128]; // Over aligned char Array objects ;
};
int main(void)
{
alignas(2048) struct data d; // this struct data Instances of will be more strictly aligned ;
}
Storage class specifier
auto - Automatic storage period and no link
register- Automatic storage with no links , You can't take the address of this object
static Static storage and internal links ( Unless this scope )
extern- Static storage period and external link
Static storage period : Storage is the execution process of the whole program .
边栏推荐
- Tenant issues.
- Li Kou 148: sorting linked list
- Master-slave replication in MySQL
- TCP三次握手四次挥手
- ERROR: could not extract tar starting at offset 000000000000020980+9231072+2
- 19_ Request forms and documents
- [xxl-job] xxl-job learning
- Prometheus+blackbox exporter+grafana monitoring server port and URL address
- The El table header merges the first four columns into one cell
- Primary key b+ tree, secondary index b+ tree and corresponding query process analysis
猜你喜欢

Prometheus + process exporter + grafana monitor the resource usage of the process

1. Mx6ul core module use serialization - view system information (II)

eslint常见报错集合

HLS Experiment 1 -- multiplier

我来图书馆小程序签到流程分析

Illustration of the insertion process of b+ tree

1. Mx6ul core module uses serial NAND FLASH read / write test (III)

(CVPR 2019) GSPN: Generative Shape Proposal Network for 3D Instance Segmentation in Point Cloud

From a data incremental processing problem, we can see the consciousness gap of technicians

What does the Red Cross in the SQL editor mean (toad and waterdrop have been encountered...)
随机推荐
ES6 advanced - using prototype object inheritance methods
我来图书馆小程序一键签到和一键抢位置工具
Adruino basic experimental learning (I)
[2021] [paper notes] biological effects of cell membrane under infrared and THz - effect is a phenomenon, action is a mechanism - the benefits of THz to medicine
Sword finger offer 28. symmetric binary tree
Implementation of Ti am335x industrial control module network and file system nfs
数仓:银行业数仓的分层架构实践
Binary search 33. search rotation sort array
Be careful about bitmap, the "memory Assassin"~
力扣148:排序链表
18. Delete the penultimate node of the linked list
17_ Form Data
Stack Title: the longest absolute path of a file
ES6高级-利用原型对象继承方法
Exclusive interview with ringcentral he Bicang: empowering future mixed office with innovative MVP
prometheus+blackbox-exporter+grafana 监控服务器端口及url地址
信息系统项目管理师---第十章沟通管理和干系人管理历年考题
2022-07-17
Product thinking drives the construction of R & D management tools
[C] Explain language file operation in detail