[Xcb] about api changes
christophpfister at gmail.com
Wed Jun 13 04:16:54 PDT 2007
Am Mittwoch, 13. Juni 2007 00:02 schrieb Thomas Hunger:
> > Another thing I discovered: for example xcb_char2b_iterator_t
> > (guess that there are others too) is of no use - because there's no
> > function returning such an iterator ... :) I don't think that they
> > really make sense and they could be removed.
> This is unfortunally not so simple: The iterators could be used by
> extension protocols. It is true that no CHAR2B is used anywhere
> (yet). A different example is the RECTANGLE iterator. It is not
> needed in xproto, but xfixes has a reply with a list of RECTANGLEs,
> so the iterator is needed.
A possible problem with that (oh - currently I seem to detect them all) is
when you have one place where you have those elements stored in continuous
list and one place where you have a non-continuous list. Right, the iterator
structure itself isn't affected by that, but the accessor functions are - so
in theory you would need to name the accessor functions not xcb_<it-name>_*
but xcb_<context>_* - luckily non-continuous lists aren't used much and this
problem hasn't arised (yet) ...
(Those issues are somewhat the cost we have to pay to use iterators in c; in
languages like c++ you can handle it way more elegantly).
> Extensions could be installed much later than xproto, so there are two
> 1) The extension creates its own private iterator if it does not
> exist yet.
> 2) It can expect that an iterator already exists if the type is
> I believe that 2) is the only way to go. So we should create all
> iterators even if they are not needed.
Okay, 2) seems to be the realistic way - just pray that the worst case
described above won't happen.
More information about the Xcb