NOINLINE
void testC(){
int
a
=
10
;
int
*
b
=
new
int
(
11
);
auto c
=
make_unique<
int
>(
12
);
auto
*
d
=
new
float
(
13
);
auto testNoCatch
=
[](
int
s,
int
t)
-
> void {
LOGD(
"testC called lambda function : %d"
, s
+
t);
};
auto testCatch
=
[
=
,&c,&d](
int
s)
-
> void {
LOGD(
"testC called lambda function : {%d} | {%d,%d,%d,%f}"
,
+
+
s,a,
*
b,
*
c,
*
d);
};
/
/
LOGD(
"testC testNoCatch typeid:%s | testCatch typeid:%s"
,typeid(testNoCatch).name(),typeid(testCatch).name());
LOGD(
"testC ------ "
);
testNoCatch(
3
,
4
);
testCatch(
2
);
/
/
&testCatch 拿到的是他准备好的参数在栈区的首地址
LOGD(
"testC &testCatch %p"
, &testCatch);
LOGD(
"testC &testNoCatch %p"
, &testNoCatch);
void
*
funcAddress
=
nullptr;
auto testCatchNew
=
[
=
,&c,&d,&funcAddress](
int
s)
-
> void {
/
/
xASM(
"MOV %0, lr"
:
"=r"
(funcAddress)::);
/
/
[&funcAddress]()
-
> void{
/
/
if
(funcAddress
=
=
nullptr) xASM(
"MOV %0, lr"
:
"=r"
(funcAddress)::);
/
/
}();
LOGD(
"testC called lambda function : {%d} | {%d,%d,%d,%f}"
,
+
+
s,a,
*
b,
*
c,
*
d);
};
testCatchNew(
3
);
LOGD(
" %p "
, funcAddress);
free(b);
}