[cfe-dev] Reflection
David Chisnall
csdavec at swan.ac.uk
Tue Dec 14 13:08:58 PST 2010
On 14 Dec 2010, at 19:44, Russell Harmon wrote:
> What? The struct definition doesn't provide an authoritative definition?
The struct definition can be in a header, and very often is. The header can be included in, potentially, hundreds of compilation units. For example, any file that includes Cocoa.h or Foundation.h (i.e. pretty much any Objective-C source file) will contain definitions of the NSRange structure. Where would you emit the metadata? One copy in every single compilation unit that included this header?
In contrast, every Objective-C class has exactly one @implementation directive for the class, which contains all of the instance variable metadata and all of the method / property metadata for ones that are declared on the class. It can have additional @implementation directives for categories, but these contain abridged metadata (i.e. just the additions made by the category).
For C++, the vtable and RTTI data is emitted in the compilation unit that contains the definition of the first virtual member function (I think that's specified by C++, but I'm not overly familiar with the spec, so it may just be specified by the Itanium ABI).
David
--
This email complies with ISO 3103
More information about the cfe-dev
mailing list