What is the cost of sizeof?

前端 未结 7 1766
一向
一向 2021-02-05 10:06

What is the cost of sizeof?

I would expect:

  • sizeof(someclass) can be known at compile time
  • sizeof(someStaticArray) can be known at compile time
7条回答
  •  萌比男神i
    2021-02-05 10:27

    sizeof(dynamicArray) will just return sizeof(pointer) because in c/c++ dynamic arrays are just pointers.

提交回复
热议问题