在表达式开头使用插入符号 ^ 符号的预处理器宏 [英] Preprocessor macro using caret ^ symbol at the start of an expression
本文介绍了在表达式开头使用插入符号 ^ 符号的预处理器宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
看这个页面:http://www.mikeash.com/pyblog/friday-qa-2010-12-31-c-macro-tips-and-tricks.html
我发现这段代码带有 ^{
... }()
语法,插入符号/括号在做什么?
I found this snippet of code with ^{
... }()
syntax, what are the caret/brackets doing?
#define MAX(x, y) (^{ \
int my_localx = (x); \
int my_localy = (y); \
return my_localx > my_localy ? (my_localx) : (my_localy); \
}())
它看起来像是在创建一个匿名函数什么的.这个概念叫什么?我在哪里可以阅读它?
It looks like its creating an anonymous function or something. What is this concept called? Where can I read about it?
推荐答案
这是一个 C 块.它很像一个匿名函数(在使用中,而不是在结构中).您可以在 Mike Ash 的网站和 Apple 的文档.
It's a C block. It's quite like an anonymous function (in use, not in structure). You can read more about them on Mike Ash's site and in Apple's documentation.
这篇关于在表达式开头使用插入符号 ^ 符号的预处理器宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文