[cfe-dev] Reflection
Russell Harmon
russ at eatnumber1.com
Tue Dec 14 13:08:50 PST 2010
The initial way I'd think to deal with this is to add introspective
metadata for structs into every compilation unit and have the linker
discard redundant introspection metadata (iff the data is equal, if
not the linker should probably fail).
Alternatively, the introspective metadata could be spit out into a
separate file which is pulled in by the linker at link time.
--
Russell Harmon
On Tue, Dec 14, 2010 at 16:04, John McCall <rjmccall at apple.com> wrote:
>
> On Dec 14, 2010, at 11:44 AM, Russell Harmon wrote:
>
>> On Dec 14, 2010, at 14:10, David Chisnall <csdavec at swan.ac.uk> wrote:
>>
>>> On 14 Dec 2010, at 15:27, Russell Harmon wrote:
>>>
>>>> I didn't really think it mattered since C++ is (mostly) just a
>>>> superset of C, but I had actually intended to do this for C, not C++.
>>>
>>>
>>> From an Objective-C perspective, it would be very interesting if C structures and functions could have their types registered with the runtime. This would probably add a lot of overhead for types - unlike Objective-C classes, they don't have a single location with an authoritative definition, but for functions it would be relatively cheap.
>> What? The struct definition doesn't provide an authoritative definition?
>
> David's saying that there isn't a unique translation unit responsible for defining the struct. This is true even in C++, unless the class in question has a key function.
>
> John.
More information about the cfe-dev
mailing list