当前位置:网站首页>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 .
边栏推荐
- 我来图书馆小程序签到流程分析
- scipy.sparse.vstack
- Annotation development
- 1. Mx6ul core module serial -iot-6ulx core module brief introduction (I)
- ES6 advanced - inherit parent class attributes with constructors
- Handling process of the problem that the virtual machine's intranet communication Ping fails
- el-table 表头合并前四列,合并成一个单元格
- 【红队】ATT&CK - 利用BITS服务实现持久化
- Binary logs in MySQL
- ES6高级-利用构造函数继承父类属性
猜你喜欢

Yum install MySQL FAQ

Error reporting caused by local warehouse

National standard gb28181 protocol video platform easygbs message pop-up mode optimization

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

AMD64(x86_64)架构abi文档:

I came to the library applet check-in process analysis

C unit test

Activiti workflow gateway

Annotation development

Adruino 基础实验学习(一)
随机推荐
17_表单数据
Stack Title: the longest absolute path of a file
商业智能BI全解析,探寻BI本质与发展趋势
Eslint common error reporting set
AMD64(x86_64)架构abi文档:中
[reading notes] user portrait methodology and engineering solutions
由一个数据增量处理问题看到技术人员的意识差距
2022-07-17
简单使用 MySQL 索引
项目管理:精益管理法
我来图书馆小程序一键签到和一键抢位置工具
3. Upload the avatar to qiniu cloud and display it
微信小程序解密并拆包获取源码教程
Master-slave replication in MySQL
[early knowledge of activities] list of recent activities of livevideostack
1. Mx6ul core module use serialization - view system information (II)
TCP three handshakes and four waves
Product thinking drives the construction of R & D management tools
19_ Request forms and documents
栈题目:文件的最长绝对路径