Re-working GNCId: removing GNCIdType enum

Dave Peticolas dave@krondo.com
24 Nov 2001 16:01:14 -0800


--=-ea8p32hZhaZhn29WveF8
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Sat, 2001-11-24 at 15:56, Derek Atkins wrote:
> Dave Peticolas <dave@krondo.com> writes:
>=20
> > The query<->scm conversion routines in engine-helpers.c uses
> > that enum. But if they change to strings, the obvious solution
> > would be to use the strings themselves as part of the encoding.
> >=20
> > dave
>=20
> GRF...  I think changing them to strings would inherit
> too much overhead.  In particular, switch statements
> would turn into a long if (!strcmp()) {} else if (!strcmp()) {}...
> One would think that all those strcmps would be a lot of extra
> overhead compared to the switch().

With extendable types, switch statements would have to
mostly go away, since they imply a fixed number of types.
I think we would use hash tables instead, which at least
gives you only about one strcmp.


> Instead, I think I just want to use a guint32 and let modules
> choose their own (unique) type-value (as opposed to their
> own unique type-string).
>=20
> Do you have a preference of strings vs. integers?

I think we should either have strings or dynamically-assigned
integers like the gtk type system uses. Statically-assigned
integers are not so nice, unless they are mechanically assigned
like an enum. Personally, I prefer strings.

dave


--=-ea8p32hZhaZhn29WveF8
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA8ADTK5effKKCmfpIRAre3AJ4mCd771esfkzrq8FqHdG4BJjeXnwCg6mpI
j/RZ2Y5WPhC0+2qgO/af2+Y=
=Y6ZX
-----END PGP SIGNATURE-----

--=-ea8p32hZhaZhn29WveF8--