[PATCH wayland] connection: Print the content of arrays in closures

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Fri Dec 1 17:38:04 UTC 2017


On Fri, Dec 01, 2017 at 05:08:15PM +0000, Daniel Stone wrote:
> Hi,
> 
> On 10 July 2017 at 19:28, Emmanuel Gil Peyrot
> <emmanuel.peyrot at collabora.com> wrote:
> > The current behaviour when WAYLAND_DEBUG is set is to print “array”,
> > which is quite unhelpful.
> >
> > This patch prints a list of the bytes present in the array.  It doesn’t
> > try to interpret it as uint32_t or anything, leaving that to the reader
> > because this information isn’t present in the protocol description.
> 
> To be honest, I'm not really wild about this one. All the array users
> I know of (key/button, xdg surface states) are uint32_t. I'd prefer to
> add a pretty-printing hint to the protocol - this could specify how to
> interpret arrays, and also scratch my long-standing itch of printing
> uints with %x rather than %u when it makes sense to ...

I would be all for a machine-readable description of the array’s
content, especially to help bindings in languages such as Java or Rust,
which currently have to hardcode the representation on a case by case
basis.  Better debug would only be a nice side effect.

In the meantime, displaying each byte as an uint8_t guarantees there is
no unintended (wrong) interpretation, and reminds us that we don’t have
that yet. :)

> 
> Cheers,
> Daniel

-- 
Emmanuel Gil Peyrot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20171201/ddd3deb7/attachment.sig>


More information about the wayland-devel mailing list