[英]can anyone explain how the “->” is implemented in the #define
I'm working on a reference design with this line as a #define我正在使用这条线作为#define 进行参考设计
#define MEDIA_EXT_STATE "\"adv7611 12-004c\":1 -> \"40080000.tpg\":0[%d]"
The sprintf function uses it which is then passed to the media_parse_setup_links()
function. sprintf function 使用它,然后将其传递给
media_parse_setup_links()
function。
sprintf(media_formats, MEDIA_EXT_STATE, 1);
ret = media_parse_setup_links(media, media_formats);
The macro defines MEDIA_EXT_STATE
as a string literal, similar as宏将
MEDIA_EXT_STATE
定义为字符串文字,类似于
#define FOOBAR "foo -> bar"
defines FOOBAR
as the string literal "foo -> bar"
.将
FOOBAR
定义为字符串文字"foo -> bar"
。 Maybe you got confused by the escaped "
, but thats just like with ordinary string literals:也许您对转义的
"
感到困惑,但这就像普通的字符串文字一样:
std::cout << "\"123";
prints "123
.打印
"123
.
To know what is the meaning of the ->
in the string, you'd have to look into the implementation of media_parse_setup_links
or read the documentation.要知道字符串中
->
的含义是什么,您必须查看media_parse_setup_links
的实现或阅读文档。
It simply translates to:它简单地翻译为:
sprintf(media_formats, "\"adv7611 12-004c\":1 -> \"40080000.tpg\":0[%d]", 1);
There is no pointer operation, as it is just part of the string.没有指针操作,因为它只是字符串的一部分。
When removing the quotes it becomes more obvious:删除引号时,它变得更加明显:
sprintf(media_formats, "'adv7611 12-004c':1 -> '40080000.tpg':0[%d]", 1);
can anyone explain how the “->” is implemented
谁能解释一下“->”是如何实现的
It's just text.这只是文字。 It is "implemented" the same way as this:
它的“实现”方式与此相同:
std::string example = "->";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.