[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: goops C interface
From: |
Carl R. Witty |
Subject: |
Re: goops C interface |
Date: |
27 Oct 2000 11:37:30 -0700 |
Eric Moore <address@hidden> writes:
> 1) do people prefer some kind of giant varargs style function that
> defines a class, or one that takes a struct that defines it?
The latter. It's been my experience that giant varargs functions tend
to grow uglier and uglier.
In fact, I like APIs like this:
class_definition_struct cds;
init_class_definition_struct(&cds);
cds.name = "foo";
cds.slots = ...;
define_class(&cds);
That means you can add new fields to class_definition_struct, give
them sensible default values, and old code will continue to work with
only a recompile.
With a bit more work, you can set things up so that new fields don't
even require a recompile (i.e., so that you can use a newer shared
library, with more fields in class_definition_struct, with an older
executable). I haven't been building shared libraries when I've used
this technique, so I haven't bothered, but it's worth considering for
this application.
Carl Witty
- Re: goops C interface, (continued)
Re: goops C interface, Mikael Djurfeldt, 2000/10/25
- Re: goops C interface, Eric Moore, 2000/10/27
- Re: goops C interface, Michael Livshin, 2000/10/27
- Re: goops C interface, Bruce Korb, 2000/10/27
- Re: goops C interface,
Carl R. Witty <=
- Re: goops C interface, Dirk Herrmann, 2000/10/27
- Re: goops C interface, Dale P. Smith, 2000/10/27
- Re: goops C interface, Michael Livshin, 2000/10/28