At Tue, 08 Mar 2005 17:13:13 +0100, Ludovic Court�s wrote: > > "Neal H. Walfield" <[EMAIL PROTECTED]> writes: > > > I am not entirely clear what you intend. Do you want to apply this > > technique to hurd_cap_obj_t and hurd_cap_class_t? > > I was trying to address the question of how to allow caller object > allocation while not exposing data structures. In your previous > example, you mentioned that this would be needed for `struct > hurd_cap_ctx_cap_use' and you suggested that this could be achieved by > defining a function that returns the size of this data structure: > > struct hurd_cap_ctx_cap_use *cap_ctx = alloca (hurd_cap_ctx_size ()); > > I'm just saying that instead of making an actual function call (not > inlined) to `hurd_cap_ctx_size ()', the caller could do something like: > > struct hurd_cap_ctx_cap_use *cap_ctx = > alloca (hurd_class_instance_size (&hurd_cap_ctx_cap_use_class)); > > And this even saves a function call since `hurd_class_instance_size ()' > can be inlined.
I understand your intention a bit better, thanks. I am against putting the size of the class into a structure if we can avoid it. I think this doesn't save enough CPU cycles relative to a function to justify the per-class memory overhead. Further, it makes compile time optimization harder. For instance, if we decide to expose the structure for another reason, hurd_cap_ctx_size will reduce to an inline sizeof. Thanks, Neal _______________________________________________ L4-hurd mailing list [email protected] http://lists.gnu.org/mailman/listinfo/l4-hurd
