野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10262|回复: 4

printf()在 C 标准库函数中实质是一个宏,这个宏找不到。

[复制链接]
发表于 2015-7-14 12:28:33 | 显示全部楼层 |阅读模式
《STM32开发实战指南》, 第八章,串口通讯
printf()在 C 标准库函数中实质是一个宏,最终是调用了 fputc() 这个函数。
这个宏在哪里呀,都找不到的?
在哪个头文件?

回复

使用道具 举报

发表于 2015-7-14 13:43:24 | 显示全部楼层
printf是个标准库函数
在stdio.h文件中
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-7-14 15:15:32 | 显示全部楼层
在stdio.h文件中,用关键词“printf”查找,好象也没查到什么#define的宏定义啊,没查到printf()调用了 fputc() 这个函数的宏定义。
只查到下列:
#pragma __printf_args
extern _ARMABI int fprintf(FILE * __restrict /*stream*/,
                    const char * __restrict /*format*/, ...) __attribute__((__nonnull__(1,2)));
//***********************************************************************
#pragma __printf_args
extern _ARMABI int printf(const char * __restrict /*format*/, ...) __attribute__((__nonnull__(1)));
//*****************************************************************************
#pragma __printf_args
extern _ARMABI int _printf(const char * __restrict /*format*/, ...) __attribute__((__nonnull__(1)));
/*****************************************************************************
回复 支持 反对

使用道具 举报

发表于 2015-7-14 15:26:12 | 显示全部楼层
extern _ARMABI int printf(const char * __restrict /*format*/, ...) __attribute__((__nonnull__(1)));这个就是
回复 支持 反对

使用道具 举报

发表于 2015-8-11 17:48:37 | 显示全部楼层
同问,不理解这里
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-9-22 10:38 , Processed in 0.027326 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表