[PATCH weston 5/6] libweston-desktop/xwayland: XWAYLAND surfaces are never 'added'

Daniel Stone daniel at fooishbar.org
Thu Nov 24 15:34:23 UTC 2016


Hi,

On 24 November 2016 at 15:22, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Thu, 24 Nov 2016 16:02:14 +0100 Quentin Glidic <sardemff7+wayland at sardemff7.net> wrote:
>> Not a big fan of asserts in internal stuff, but if you feel like it’s
>> needed:
>
> Heh, my view is quite the opposite.
>
> Internal stuff is where the asserts actually belong in. If internal
> stuff is misused or buggy, we want to know about it. Internal API is
> just as important as external API, even if it does not follow the same
> stability rules. In fact, because internal API does not follow any
> stability rules, it is much more important to sprinkle lots of asserts
> to catch misuse, since the patterns of proper use change much more
> likely.
>
> OTOH, external APIs often want to return errors instead of crashing the
> whole program, so asserts are slightly less appropriate there.
>
> Hitting an assert is much easier to debug than misbehavior or a crash.
> Catching should-never-happens is a good thing.

Absolutely. If we land in an unexpected situation, best to scream very
very loudly, rather than just try to stumble on. Plus, as pq says,
they serve as a cheap form of documentation, where it makes it very
obvious what you can and can't do with particular blocks of code.

Cheers,
Daniel


More information about the wayland-devel mailing list