当前位置:网站首页>assert _Aligns
assert _Aligns
2022-07-26 02:23:00 【处女座程序员的朋友】
宏assert的定义依赖于标准库不定义另一个宏NDEBUG.
若NDEBUG 在包含了<assert.h>的源代码中的点定义为宏名,则assert不做任何事。
若不定义NDEBUG,则assert将其参数(必须拥有标量类型)与零比较相等,若相等,则assert在标准错误输出上输出实现指定的诊断信息,并调用abort。诊断信息要求包含表达式的文本,还有标准宏 _FILE_、_LINE_以及预定义变量_func_的值。
参数
condition --标量类型表达式
返回值
(无)
示例:
#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
出现于声明语法中,作为修改声明对象对齐要求的指定符。
表达式:任何值为合法对齐或零的整数常量表达。
类型:任何类型名称
_Aligns 只能在声明不是位域,且不拥有寄存器存储类的对象时使用。它不能用于函数参数声明,也不能用于 typedef。用于声明时。设置被声明对象的对齐要求为:
1)表达式的结果,除非它是零。
2)类型的对齐要求,即设置为 _Alignof(type)
示例:
#include<stdalign.h>
#include<stdio.h>
//每一个 struct sse_t类型的对象会在16字节边界对齐。
struct sse_t
{
aligns(16) float sse_data[4];
};
//这种struct data 的每一个对象都会在128字节边界对齐
struct data{
char x;
alignas(128) char cacheline[128]; // 过对齐的char数组对象;
};
int main(void)
{
alignas(2048) struct data d; //此 struct data 的实例会更严格地对齐;
}
存储类指定符
auto -自动存储期与无链接
register-自动存储与无链接,不能取这种对象的地址
static 静态存储与内部链接(除非这块作用域)
extern-静态存储期与外部链接
静态存储期:存储是整个程序的执行过程。
边栏推荐
- I.MX6UL核心模块使用连载-eMMC读写测试 (四)
- scipy.sparse.csr_matrix
- Obsidian mobile PC segment synchronization
- Recorded target detection NMS (non maximum suppression)
- Postman报Json序列化错误
- Pinia的数据持久化插件 pinia-plugin-persist
- Wechat applet - get user location (longitude and latitude + city)
- 18. Delete the penultimate node of the linked list
- [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
- 1. Mx6ul core module serial Ethernet test (VII)
猜你喜欢

1. Mx6ul core module serial -iot-6ulx core module brief introduction (I)

Wechat applet decryption and unpacking to obtain source code tutorial

1. Mx6ul core module serial Ethernet test (VII)

Design and driver transplantation of matrix keyboard circuit of Ti am335x industrial control module

Yum install MySQL FAQ

Primary key b+ tree, secondary index b+ tree and corresponding query process analysis

GAMES101复习:光栅化

力扣148:排序链表

prometheus+redis-exporter+grafana 监控redis服务

National standard gb28181 protocol video platform easygbs message pop-up mode optimization
随机推荐
Prove that perfect numbers are even
Error reporting caused by local warehouse
2022-07-17
npm link的简单介绍及使用
i. Mx6ull snvs power domain GPIO status hold verification
Effectively solve the problem of garbled code when idea runs the web project (with detailed steps)
Prometheus + process exporter + grafana monitor the resource usage of the process
2022-07-17
Data warehouse: Practice of hierarchical structure of data warehouse in banking industry
由一个数据增量处理问题看到技术人员的意识差距
Monitoring of debezium synchronization debezium
[2019] [paper notes] tunable THz broadband absorption based on metamaterials——
Wechat applet - get user location (longitude and latitude + city)
Implementation of Ti am335x industrial control module network and file system nfs
【PyQt5打包为exe】
Adruino 基础实验学习(一)
Quick start of adding, deleting, modifying and checking business
[paper reading] coat: CO scale conv attentional image transformers
Information System Project Manager - Chapter 10 communication management and stakeholder management examination questions over the years
From a data incremental processing problem, we can see the consciousness gap of technicians