本文介绍了Arduino的F():这是什么实际上做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经问过一个类似的问题,但我知道我可以' ŧ使磁头或赘言和templateness的尾巴。我是一个C(而不是C ++)程序员。

I have asked a similar question before, but I realize that I can't make heads or tails of the macrology and templateness. I'm a C (rather than C++) programmer.

什么是F()实际上呢?当它的东西字符转换成pgmem?当它拉出来的字符的pgmem?是否缓存它们?它是怎样处理的低内存情况?

What does F() actually do? When does it stuff characters into pgmem? When does it pull characters out of pgmem? Does it cache them? How does it handle low-memory situations?

推荐答案

有没有涉及模板,只有函数重载。在 F()宏做了两件事:

There are no templates involved, only function overloading. The F() macro does two things:

蒙上的结果PSTR() __ FlashStringHelper * 。功能,如打印的println 超载,这样,在接收到 __ FlashStringHelper * 的说法,他们正确地取消引用在闪存中的字符。

casts the result of PSTR() to __FlashStringHelper*. Functions such as print and println are overloaded so that, on receiving a __FlashStringHelper* argument, they correctly dereference the characters in the Flash memory.

这篇关于Arduino的F():这是什么实际上做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!