用于 C/C++ Debug 的宏函数

Debug.h

用于打印 Debug 信息的小工具:

c 复制代码
#pragma once

#include <stdio.h>

#define DEBUG 1

#define pn puts("")
#define where printf("%s(%d)-<%s>.\n\n", __FILE__, __LINE__, __FUNCTION__)

#if (DEBUG == 1)
#define print_error(fmt, ...)                                       \
	{                                                        		\
        printf(fmt "some error message.\n", __VA_ARGS__); 			\
        where;                                                      \
    }
#else
#define print_error(fmt, ...) 		\
    {                            	\
        printf(">");             	\
        fflush(stdout);          	\
    }
#endif
相关推荐
东方小月1 小时前
从零开发一个 Coding Agent(四):使用状态机校验大模型事件流
前端·人工智能·后端
Csvn1 小时前
🧩 ESM vs CJS 混用的 7 个「天坑」——从 TypeScript 编译到 Node 与浏览器
前端
Csvn1 小时前
🎯 Web 性能 API 集合:Performance Observer 的 5 个冷门妙用
前端
Csvn1 小时前
深入 React 闭包陷阱:从根源上理解并根治 stale closure
前端
whyfail2 小时前
前端学 Spring Boot(8):接口为什么越用越慢?
前端·spring boot·后端
麻瓜老宋2 小时前
AI开发C语言应用按步走,表达式计算器calc的第二十三步,多行输入、进制输出、错误恢复、常量折叠、配置加载等
c语言·开发语言·atomcode
用户059540174462 小时前
LangChain 记忆测试踩坑实录:这两个坑让我排查了 4 小时
前端·css
程序员黑豆2 小时前
鸿蒙应用开发:@Monitor 装饰器使用教程
前端·harmonyos
SamChan903 小时前
在Web应用中集成PDF多语言翻译功能:PDFTranslator API实战指南
前端·python·ai·pdf·yapi·机器翻译
kyriewen3 小时前
AI Agent 9秒删光了生产数据库——我给自己的项目做了5个紧急检查
前端·ai编程·claude