[Y-devel] Y-Protocol proposal, again :-)

Maurice van der Pot griffon26 at kfk4ever.com
Tue Apr 13 10:33:21 BST 2004


While we're on the subject of protocol changes,
can anyone tell me why you would want text strings
to identify types of events/messages instead
of something like an unsigned 32-bit value?

So far I have heard the argument that it would
prevent recompilation of sources each time a new
message type is added. Although this might be true,
I don't think having to do some recompilation of
only a small part of the total source and only 
when message types change, should be a reason to
opt for something that has a negative impact on
performance. Of course I know that the impact is
minimal, but you don't say "let's take this thing
that's slightly slower, because it is only slightly
slower."

Based on this, I'd say use fixed size, fast and easy
to convert fields like an unsigned 32-bit integer.

Just one remark about use of 32-bit values: they don't
have to be human readable and you don't have to do
math with it, so don't reorder them when you receive
them if they don't match your architecture's endianness.
It's faster and just as easy to have a macro swap 
the bytes in the header file during compilation.
All you are allowed to do with the values is comparing
equality and writing them to messages anyway.

Maurice.




More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved