Re: R: [AD] Config routines, alpha 5

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


"Angelo Mottola" <a.mottola@xxxxxxxxxx> writes:

> int al_get_bool(int def, char *key)
> {
[...skipped...]
>    switch (entry->dat.type) {
[...skipped...]
>       default:

Maybe it should try to convert variable with unknown types to
temporary string, and then try to convert that string to the
destination type?  Conversions to/from strings should be always
defined anyway, so it would make it easier to extend configuration
system with new types, without the need to write all conversions for
them (only conversions to/from string will be required).

But conversion from string to given type should handle cases when
string contents is not recognized as a valid representation of this
type.

-- 
Michael Bukin



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/