替换printf中的标志

code

复制代码
#include <stdio.h>

void string_in_string_test1(void) {
#define FLAG "d"
#if ((defined _WIN32) || (defined _WIN64))
	printf_s("hahaha %" FLAG "hahaha\n", 100);
#elif ((defined __liunx__))
	printf("hahaha %"FLAG"hahaha\n", 100);
#endif
}

performance

conclusion

GNU编译器,FLAG前后的空格可加可不加

MSBUILD编译器,FLAG前的空格必须加

相关推荐
我不会插花弄玉12 小时前
13.多路转接epoll【由浅入深-网络】
网络·c++·epoll
郝学胜-神的一滴14 小时前
Effective STL 条款03:容器中的对象复制要廉价且正确
开发语言·数据结构·c++·算法·rpc·stl
西西弗Sisyphus15 小时前
C++ explicit 关键字工程实践
开发语言·c++
戊本菌15 小时前
进程(三)进程优先级:谁先上 CPU
linux·c语言·硬件架构
AIgorithmGEEK17 小时前
std::unordered_map 与 std::unordered_set:接口、算法技巧与权衡 (速查)
c++·算法·哈希表·负载因子·桶·unordered_map·unordered_set
嵌入式 Linux手记19 小时前
一块内存,三种解释:union 的真实用法
linux·c语言·驱动开发·嵌入式
一拳一个呆瓜19 小时前
【STL】头文件:<cmath>
c++·stl
草莓熊Lotso20 小时前
【C++ 基于微服务的即时通讯系统】ElasticSearch 用户数据管理实现
linux·数据库·c++·elasticsearch·微服务·架构
慧都产品智能化20 小时前
Qt 开发 CAD/CAM 工序表的隐性成本分析
c++·qt·qt5·qt6.3
宝桥南山21 小时前
Visual Studio 2026新特性 - 可以直接连接DeepSeek(使用Custom Endpoint Provider配置项)
ide·microsoft·微软·aigc·.net·visual studio