size of a datatype without using sizeof

后端 未结 21 1964
慢半拍i
慢半拍i 2020-12-01 02:34

I have a data type, say X, and I want to know its size without declaring a variable or pointer of that type and of course without using sizeof oper

21条回答
  •  一整个雨季
    2020-12-01 02:48

    You could puzzle it out by reading the ABI for your particular processor, which explains how structures are laid out in memory. It's potentially different for each processor. But unless you're writing a compiler it's surprising you don't want to just use sizeof, which is the One Right Way to solve this problem.

提交回复
热议问题