October 21, 2024
Chicago 12, Melborne City, USA
C++

How should I handle errors in Wayland event handler callbacks in C?


I’m just getting started with Wayland and I think I understand the basics, but I’m wondering how to handle errors that occur within event handler callbacks. Is there a standard way of doing this? I presume higher-level languages would use exceptions or something, but since we don’t have that luxury in C, what do people usually do?

Right now, I’m passing my application object as the data argument to the callbacks, so the only thing I can think of is setting an error condition as part of its state and checking that in the mainloop, but this seems messy and potentially fragile, so I’m hoping to hear alternatives.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video