Could it be the case that sizeof(T*) != sizeof(const T*)?

前端 未结 4 905
遥遥无期
遥遥无期 2021-02-06 20:30

I\'m arguing with my boss about this. They say \"Yes they can be different.\"

Is it possible that sizeof(T*) != sizeof(const T*) for a type T?<

4条回答
  •  有刺的猬
    2021-02-06 20:42

    Microchip released such a C compiler where the sizeof(T*) was 2 but sizeof(const T*) was 3.

    The C compiler was not standards-compliant in a few ways, so this says nothing about this being valid (I suspect it isn't and other answers agree).

提交回复
热议问题