printing - 是否有一种可移植的方法来打印来自 C 预处理器的消息?

标签 printing c-preprocessor

我希望能够做类似的事情

#print "C Preprocessor got here!"

用于调试目的。最好/最便携的方法是什么?

最佳答案

warning 指令可能是您能得到的最接近的指令,但它并不完全独立于平台:

#warning "C Preprocessor got here!"

据我所知,这适用于除 MSVC 之外的大多数编译器,在 MSVC 上您必须使用 pragma 指令:

#pragma message ( "C Preprocessor got here!" )

关于printing - 是否有一种可移植的方法来打印来自 C 预处理器的消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3826832/

相关文章:

c - 在纯 C 函数中使用字符串作为结构名称的可变部分

c++ - 使用 C 宏将字符串转换为非字符串

C预处理器: How to create a character literal?

c++ - 错误 : pasting "operator" and "+" does not give a valid preprocessing token

css - 用Bootstrap打印富文本,BR元素被IE完全忽略

c - 如何用Win32检测彩色打印机?

css - rails : How to create a link that loads the page with print. CSS?

c++ - C++ 预处理器中的 R 和 L 有什么特别之处?

python - 范围(1 :len(df)) assigns NaN to last rows in dataframe

python - 打印 python tkinter 输出