当前位置:网站首页>C语言函数之可变参数原理:va_start、va_arg及va_end
C语言函数之可变参数原理:va_start、va_arg及va_end
2022-07-06 09:16:00 【薇远镖局】
|
|
* 输出参数ap(类型为va_list): 用于保存函数参数列表中可变参数的首指针(即,可变参数列表)
* 输入参数A: 为函数参数列表中最后一个固定参数
* 输入参数ap(类型为va_list): 可变参数列表,指向当前正要处理的可变参数
* 输入参数T: 正要处理的可变参数的类型
* 返回值: 当前可变参数的值
|
另一个比较实用的例子:printk只能在内核初始化完控制台(console_init)后才能使用。因此,在Linux内核初始化控制台前,只能使用其它函数来打印内核消息。这些函数有:
|
这些函数都是用汇编实现的,并直接从低层操作s3c2410的串口,并显示信息。因此不需要等到console_init后就可以显示信息。
为了使用这些函数,需要特性的内核选项支持:make menuconfig
Kernel hack ->
[*]Kernel low-level debugging functions
[*]Kernel low-level debugging messages via S3C UART
(0)S3C UART to use for low-level debug
但是,这些函数并没有printk功能那么强大,支持可变参数,支持格式化字符串。为了在Linux内核初始化控制台前,能使用了一个类似于printk的函数,我们将printascii函数封装到新函数debug里:
|
边栏推荐
猜你喜欢

Wangeditor rich text reference and table usage

MongoDB

Mall project -- day09 -- order module

人脸识别 face_recognition

【CDH】CDH5.16 配置 yarn 任务集中分配设置不生效问题
![[Flink] Flink learning](/img/2e/ff53e0795456e301f61da908c013af.png)
[Flink] Flink learning
![[CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect](/img/e7/a0d4fc58429a0fd8c447891c848024.png)
[CDH] cdh5.16 configuring the setting of yarn task centralized allocation does not take effect

电商数据分析--薪资预测(线性回归)

FTP file upload file implementation, regularly scan folders to upload files in the specified format to the server, C language to realize FTP file upload details and code case implementation

Small L's test paper
随机推荐
Vs2019 use wizard to generate an MFC Application
FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
Apprentissage automatique - - régression linéaire (sklearn)
Vert. x: A simple login access demo (simple use of router)
【Flink】CDH/CDP Flink on Yarn 日志配置
ES6 promise object
Kaggle竞赛-Two Sigma Connect: Rental Listing Inquiries
[CDH] modify the default port 7180 of cloudera manager in cdh/cdp environment
Come and walk into the JVM
TypeScript
Contiki source code + principle + function + programming + transplantation + drive + network (turn)
Linux Yum install MySQL
MySQL realizes read-write separation
[Bluebridge cup 2020 preliminary] horizontal segmentation
分布式节点免密登录
Learn winpwn (3) -- sEH from scratch
电商数据分析--薪资预测(线性回归)
[MRCTF2020]套娃
{one week summary} take you into the ocean of JS knowledge
Mall project -- day09 -- order module