adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Adonthell File Format


From: Kai Sterker
Subject: Re: [Adonthell-devel] Adonthell File Format
Date: Wed, 5 Aug 2009 17:36:27 +0200

On Wed, Aug 5, 2009 at 3:15 PM, Klaus Blindert<address@hidden> wrote:

> However as for the API, I have a few questions:
>
> What purpose does the T_CHAR type serve?
> It's basically a duplicate of the s_int8.

True.

> Did you ever use the T_BLOB type? I think it's
> dangerous and should go ...

No, at least a search over the source code didn't reveal anything.

> I'd rather add typed arrays T_SINT16_ARRAY and so on
> instead of that.

Yes, those could be useful.

> Finally, I found the "optional" argument cumbersome to use.
> I'll replace that by two functions, one with an default value,
> one without.
>
> u_int32 abf_get_uint32 (abf_flat_t* flat, const char* name);
> u_int32 abf_getopt_uint32 (abf_flat_t* flat, const char* name,
> u_int32 _default);
>
> (First I'm writing a C library. ABF stands for adonthell binary format.)

That's probably better. You might even go so far and make the returned
value an out parameter and have the functions return a flag that
indicates success or error. The current implementation returns a valid
value in case of an error and forces to check a separate error flag
instead (which nobody does).

My only excuse for doing it that way (and same goes for the optional
parameter) is that I didn't want to go over all the code that used
these methods and change them. But you have the chance for a fresh
start without worrying about extra work :-).

Kai




reply via email to

[Prev in Thread] Current Thread [Next in Thread]