[LLVMdev] variable sized array
baldrick at free.fr
Fri Apr 23 02:31:48 PDT 2010
> just a quick question, in llvm::TargetData,
> uint64_t MemberOffsets; // variable sized array!
> MemberOffsets has two elements, why it's variable sized ?
when a StructLayout object is allocated (in TargetData::getStructLayout),
extra memory is allocated, more than that given by the size of the type.
The extra memory is interpreted as being part of the MemberOffsets array,
and is used for storing additional member offsets beyond the first one.
This kind of trick generates warnings with gcc-4.5. Maybe it can be done
better. I thought you were supposed to use
but perhaps I am mistaken.
More information about the llvm-dev