Proposed platform assumption changes
nico at cryptonector.com
Mon Jan 30 11:17:12 EST 2012
On Mon, Jan 30, 2012 at 6:39 AM, Sam Hartman <hartmans at mit.edu> wrote:
> Nico, I'm not sure I see the point of your sfinit macro.
It does several important things for me.
First, it makes it much easier to use cscope to find your way through
code that has v-tables/ops vectors. When you see an expression like
"foo->some_field_of_foo" you can do a symbol search for
"some_field_of_foo" and see all the assignments to
".some_field_of_foo" very quickly, and then you can search for the
definitions of each of those assignments to find all possible
functions the original expression might have been calling.
Second, assuming you have a C99 compiler on some of the platforms that
you build for (MIT does) you get the benefit of safety checking from
the compiler. This matters when you have several fields of the same
type in a struct, which w/o designated initializers makes it too easy
to assign the wrong values to fields.
Third, it makes it slightly easier to write new initializers, or edit
existing ones to match changes to the struct definition, particularly
when you have structs with tens of fields because the lexical context
> To me, the named struct field initializers are all about being able to
> reorder the initializations or skip some.
That's certainly very nice, but it's not the point for me.
> Your macro doesn't do that so I don't understand why I'd want it.
Indeed, it doesn't, and I don't see how to do that with just macros,
but again, it's not the main feature for me.
More information about the krbdev