野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10740|回复: 2

代码解读

[复制链接]
发表于 2016-12-26 11:31:25 | 显示全部楼层 |阅读模式
这段代码怎么解读呀,求大神指点


/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Uncomment the line below to expanse the "assert_param" macro in the
   Standard Peripheral Library drivers code */
/* #define USE_FULL_ASSERT    1 */

/* Exported macro ------------------------------------------------------------*/
#ifdef  USE_FULL_ASSERT

/**
  * @brief  The assert_param macro is used for function's parameters check.
  * @param  expr: If expr is false, it calls assert_failed function which reports
  *         the name of the source file and the source line number of the call
  *         that failed. If expr is true, it returns no value.
  * @retval None
  */
  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
  void assert_failed(uint8_t* file, uint32_t line);
#else
  #define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */

#endif /* __STM32F10x_CONF_H */

/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

123.png
回复

使用道具 举报

发表于 2016-12-26 11:51:20 | 显示全部楼层
断言,用于检测参数的,如果参数出错就打印出错文件的名称和所在行。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-12-26 11:53:28 | 显示全部楼层
fire 发表于 2016-12-26 11:51
断言,用于检测参数的,如果参数出错就打印出错文件的名称和所在行。

在哪里被打印出来呀,能给我讲讲他的逻辑吗?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-8 06:31 , Processed in 0.040753 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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