 |
|
bilosikia
V2EX member #300795, joined on 2018-03-16 18:55:56 +08:00
|
 |
Per bilosikia's settings, the topics list is hidden |
Deals info, including closed deals, is not hidden
bilosikia's recent replies
1. 第一个是能保存成功的,1. leader 选出新的 leader 一定包含最新的 log 2. 前任 leader 的 log 谁着新任 leader 一起提交
2. 半数以上节点可用就行,A,B 挂了,只有 C 节点能当选新 leader
改成这样
printf("size %lu\n", sizeof(*pfn));
start sec 0x7fcf6ac007e2
stop sec 0x7fcf6ac00820
func1 0x7fcf6ac007e2
func2 0x7fcf6ac00801, 31
size 1
addr 0x7fcf6ac007e2
addr 0x7fcf6ac007e3
addr 0x7fcf6ac007e4
func is func1
Segmentation fault (core dumped)
对指针的加法运算是有指针指向的类型决定的,pfn ( pfn_test pfn = &__start_mysection; 这已经类型不匹配了)是指向的一个函数类型,sizeof(函数类型)= 1,
所以++ 只加了一
另外 c++是禁止对函数指针做加减法运算的
为什么 sizeof (函数类型)为一呢?
sizeof cannot be used with function types, incomplete types, or bit-field glvalues.