2. Januar 2007 02:18 Avi Alkalay wrote:
> On 12/29/06, Markus Raab <[EMAIL PROTECTED]> wrote:
> > > int keyIsUser(const Key *key) {
> > > return (key->flags & KEY_SWITCH_ISUSER)?1:0;
> > > }
> >
> > yeah, but why not implementing it with return keyIsNameUser(key->key);?
>
> Because they have different purposes.
> keyIsUser() is cheap because it only compares bits, and is used on Key
> objects.
> keyNameIsUser() is much more expansive because it compares strings, if you
> have them.
Its an not trivial (means you can forget to set the flag at some place)
optimization for a part which is *really* not performance-critical. Such
things should not be done in the state we are now.
> No, there is no useful case until we have a opposite example. I know the
>
> > documentation. Its not cheap, you have to maintain that useless flag in
> > every
> > backend.
>
> No. The flag is only maintained in the higher level API. I can't see where
> in backends they are used.
Now you really fall into the trap :-)
Flag has two meanings in elektra:
- the flags for sync key and some useless optimizations
- the flag which can be set by keySetFlag()
The second flag has of course be set by the backend, otherwise you would have
the funny beheavior:
keySetFlag (key);
kdbSetKey (h, key);
kdbGetKey (h, key);
if (keyGetFlag(key) == 0) printf ("elektra is very weird");
Elektra really should not be weird :-)
The only rational solution can be removing the flag nobody knows what it is
for.
> There is no clear semantic defined which information must be stored by the
>
> > backend anyway.
>
> Then maybe documentation must be improved, and not code.
> Backends can store the information they want in the private backend data.
> The only thing that matters is that they must fulfill the API definitions,
> which is described at http://www.libelektra.org/elektra-api/group__kdb.html
Yeah, I fully agree.
The documentation must really make clear what behavior you are going to
expect. Test cases under /tests must verify the correctness.
thank you
Markus Raab
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Registry-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/registry-list