fprintf中的成本 [英] cost of fprintf
问题描述
我正在开发的C ++为有限code /数据RAM的平台的嵌入式应用,而是无限的RAM文件系统的使用情况。
I am developing an embedded application in C++ for a platform with limited code/data RAM, but rather unlimited RAM for filesystem usage.
在寻找降低code尺寸,我意识到,fprintf中不包括()线做出了很大贡献,以产生code的大小。
While looking for reducing the code size, I realized that excluding fprintf() lines contributed a lot to the size of generated code.
我的问题是:
1.为什么fprintf中的成本如此之高?
2.如果我排除fprintf中的功能,这将是使其通过应用程序运行描述occurances日志文件的选择吗?
My questions are : 1. Why is the cost of fprintf so high ? 2. If I exclude the fprintf functionality, what would be the alternative to generate log files describing the occurances through the application run ?
推荐答案
回答你的第一个问题取决于你使用的编译器;你只能得到通过检查你的编译器一个明确的答案。正如格雷厄姆指出,格式化的实现可以是复杂的。
The answer to your first question depends on the compiler that you are using; you can only get a definitive answer by examining your compiler. As GrahamS pointed out, formatter implementation can be complicated.
尝试使用的fputs
而不是 fprintf中
来避免格式化。
Try using fputs
instead of fprintf
to avoid the formatter.
这篇关于fprintf中的成本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!