Type safety of protocol calls

Kristian Høgsberg krh at bitplanet.net
Sun Feb 6 10:22:23 PST 2011


2011/2/6 Chris Morgan <chmorgan at gmail.com>:
> On Sunday, February 6, 2011, Kristian Høgsberg <krh at bitplanet.net> wrote:
>> On Sun, Feb 6, 2011 at 11:57 AM, Chris Morgan <chmorgan at gmail.com> wrote:
>>> Hello.
>>>
>>> I ran into an issue figuring out how a resize event made it's way from
>>> window.c in the client to shell.c on the server. I think I figured out
>>> the mapping and sent a patch that performs the mapping between the two
>>> different types being used.
>>
>> I saw the patch, but the window.h #defines are defined to match the
>> protocol enumeration where they overlap for convenience.  That's
>> perfectly legal in C, safe and convenient.. You may not like that
>> technique, but claiming that the protocol isn't typesafe for this
>> reason is a little disingenuous.
>>
>> Kristian
>>
>
> Hi.
>
> I thought when a function called for an enum that in c++ a warning or
> error was generated when passing anything other than that enum into
> that function? I thought that was generally considered type safety,
> should I have called it strict type conversion instead?

You're talking about C++ and C++ type conversion.  Wayland is written in C.

Kristian


More information about the wayland-devel mailing list