当前位置:网站首页>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;
}
边栏推荐
- JSON 基本使用
- abstract class or interface
- CVPR22 Oral | shunt through multi-scale token polymerization from attention, code is open source
- How do task flow executors work?
- The kvm virtual machine cannot be started, NOT available, and the PV is larger than the partition
- 接口自动化测试实践指导(上):接口自动化需要做哪些准备工作
- 【软考 系统架构设计师】案例分析④ 软件架构风格
- Activiti7审批流
- 级联下拉菜单的实现「建议收藏」
- SQLi-LABS Page-2 (Adv Injections)
猜你喜欢
开发者必备:一文快速熟记【数据库系统】和【软件开发模型】常用知识点
Install win virtual machine on VMware
[Implementation of the interface for adding, deleting, checking, and modifying a double-linked list]
[Cloud Native] 4.2 DevOps Lectures
Metasploit常用命令、技术功能模块
好未来,想成为第二个新东方
【微服务~Nacos】Nacos之配置中心
Js fifteen interview questions (with answers)
Converting angles to radians
Space not freed after TRUNCATE table
随机推荐
Use convert_to_tensor in Tensorflow to specify the type of data
In programming languages, the difference between remainder and modulo
《强化学习周刊》第57期:DL-DRL、FedDRL & Deep VULMAN
孙正义亏掉1500亿:当初投贵了
为什么这么多人都想当产品经理?
4D Summary: 38 Knowledge Points of Distributed Systems
nvm下node安装;node环境变量配置
Xiaohei leetcode's refreshing rainy day trip, just finished eating Yufei Beef Noodles, Mala Tang and Beer: 112. Path Sum
Usage of placeholder function in Tensorflow
JS–比想象中简单
js十五道面试题(含答案)
xctf攻防世界 Web高手进阶区 ics-05
Ehrlich screening method: Counting the number of prime numbers
Simple questions peek into mathematics
2022年中国第三方证券APP创新专题分析
The overall construction process of the Tensorflow model
Reinforcement Learning Weekly Issue 57: DL-DRL, FedDRL & Deep VULMAN
Evolution of MLOps
POWER SOURCE ETA ETA Power Repair FHG24SX-U Overview
开发者必备:一文快速熟记【数据库系统】和【软件开发模型】常用知识点