Question

Is there a way to get the compile-time byte alignment of a class instance in Xcode? In visual studio there is a flag (/d1reportSingleClassLayoutXXX where XXX is the class name) that will dump the class layout to the output window. Is there a similar flag/function in Xcode?

Like this except for using llvm.

Was it helpful?

Solution

If you need to query the layout of a specific object at compile-time, all of the useful information is available via sizeof(struct X), __alignof(struct X), and offsetof(struct X, member).

References:

__alignof

offsetof

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top