What is guaranteed about the size of a function pointer?

前端 未结 4 528
梦谈多话
梦谈多话 2020-11-27 06:15

In C, I need to know the size of a struct, which has function pointers in it. Can I be guaranteed that on all platforms and architectures:

  • the size of a void*
4条回答
  •  隐瞒了意图╮
    2020-11-27 07:21

    There is a practical example of differing sizes that used to be common. In the MS-DOS & early Windows C programming, in the "medium" memory model you had 16-bit data pointers but 32-bit function pointers, and the "compact" memory model was the other way round.

提交回复
热议问题