#include <stdio.h>
#include <array>
#include <vector>
std::vector<int> foo() {
int i;
std::vector<int> a(100);
printf("%p, %p, %p\n", &i, &a, &(a[0]));
return a;
}
int main() {
int i;
std::vector<int> b = foo();
printf("%p, %p, %p\n", &i, &b, &(b[0]));
}
Run Code Online (Sandbox Code Playgroud)
为什么a和上面b有相同的地址?这是某种“跨堆栈框架”优化吗?即使我使用该-O0选项,结果也是一样的。
输出:
$ vim main.cpp
$ cc -std=c++11 -lc++ main.cpp
$ ./a.out
0x7ffee28d28ac, 0x7ffee28d28f0, 0x7ff401402c00
0x7ffee28d290c, 0x7ffee28d28f0, 0x7ff401402c00
$
Run Code Online (Sandbox Code Playgroud) Apple,iOS,IAP.
官方文件说:
产品类型 - 用户可以购买 - 出现在收据中 - 同步设备 - 已恢复
消耗品 - 多次 - 一次 - 未同步 - 未恢复
不续订 - 多次 - 一次 - 通过您的应用 - 通过您的应用
当然,如果我愿意,消费品可以与"我的应用程序"不续订相同,那么具体的区别是什么?为什么Apple将这两种类型区分开来?