Are there any platforms where pointers to different types have different sizes?

前端 未结 7 1075
刺人心
刺人心 2020-11-22 12:40

The C standard allows pointers to different types to have different sizes, e.g. sizeof(char*) != sizeof(int*) is permitted. It does, however, require that if a

7条回答
  •  遇见更好的自我
    2020-11-22 12:45

    Back in the golden years of DOS, 8088s and segmented memory, it was common to specify a "memory model" in which e.g. all code would fit into 64k (one segment) but data could span multiple segments; this meant that a function pointer would be 2 bytes, a data pointer, 4 bytes. Not sure if anybody is still programming for machines of that kind, maybe some still survive in embedded uses.

提交回复
热议问题