当前位置:网站首页>typedef和#define的花里胡哨的用法
typedef和#define的花里胡哨的用法
2022-08-09 21:54:00 【ma_de_hao_mei_le】
友链
还是在看驱动代码,看到了这个:
WDFDEVICE hDevice;
我去找WDFDEVICE
的定义
DECLARE_HANDLE( WDFDEVICE );
然后我又去找DECLARE_HANDLE
的定义
#define DECLARE_HANDLE(name) struct name##__{
int unused;}; typedef struct name##__ *name
看懂是啥意思了吗
这相当于定义了一个WDFDEVICE
结构体
#include <stdio.h>
#include <malloc.h>
#define DECLARE_HANDLE(name) struct name##__{
int unused;}; typedef struct name##__ *name
//struct WDFDEVICE__ {
// int unused;
//};
//
//typedef struct WDFDEVICE__* WDFDEVICE;
int main() {
DECLARE_HANDLE(test_struct_name);
test_struct_name test_struct = (test_struct_name)malloc(sizeof(test_struct_name__));
if (NULL == test_struct) return 0;
test_struct->unused = 123;
printf("%d\n", test_struct->unused);
return 0;
}
边栏推荐
- random.normal() and random.truncated_normal() in TF
- laravel table migration error [easy to understand]
- xctf攻防世界 Web高手进阶区 shrine
- In-depth analysis of Apache EventMesh cloud-native distributed event-driven architecture
- mysql 找不到或无法加载已注册的 .Net Framework Data Provider。
- Xiaohei leetcode's refreshing rainy day trip, just finished eating Yufei Beef Noodles, Mala Tang and Beer: 112. Path Sum
- 基于ABP的AppUser对象扩展
- Deceptive Dice
- How do task flow executors work?
- OpenMLDB + Jupyter Notebook:快速搭建机器学习应用
猜你喜欢
Simple questions peek into mathematics
Flask introductory learning tutorial
Flask's routing (app.route) detailed
在“企业通讯录”的盲区,融云的边界与分寸
开发者必备:一文快速熟记【数据库系统】和【软件开发模型】常用知识点
从产品角度看 L2 应用:为什么说这是一个游乐场?
Domestic mobile phone manufacturers once fought for it, but now it is the first to collapse...
【服务器数据恢复】SAN LUN映射出错导致文件系统数据丢失的数据恢复案例
leetcode 39. 组合总和(完全背包问题)
FileZilla搭建FTP服务器图解教程
随机推荐
Rust dereference
leetcode 38. 外观数列
【软考 系统架构设计师】案例分析④ 软件架构风格
random.normal() and random.truncated_normal() in TF
力扣 1413. 逐步求和得到正数的最小值
FileZilla搭建FTP服务器图解教程
深度剖析 Apache EventMesh 云原生分布式事件驱动架构
金山云地震,震源在字节?
The round functions in the np, ceil function and floor function
Interviewer: How to deal with Redis big key?
Usage of placeholder function in Tensorflow
【服务器数据恢复】SAN LUN映射出错导致文件系统数据丢失的数据恢复案例
mysql 找不到或无法加载已注册的 .Net Framework Data Provider。
js数组对象去重
PHP 2D array sorted by a field
为什么这么多人都想当产品经理?
简单问题窥见数学
跨端技术方案选什么好?
AI Knows Everything: Building and Deploying a Sign Language Recognition System from Zero
navicat 快捷键