Squib of the day: Macro cleanup

Abandoned MachineryIn GNOME bug 94111, Havoc points out that some of the macros we use for checking certain features of windows are incorrect.  Fields with names like has_foo_func denote whether the window gives us permission to foo it.  Macros with names like ALLOWS_foo take these into consideration and also whether the operation is possible right now (for example, you can maximise a window only if it allows maximisation in general, and also if it’s not currently maximised).

The bug requires checking these macros have correct names, and making sure they do what they’re intended to do.

This whole business does make me wonder why we’re using macros for this sort of thing, anyway.  Given a modern compiler, do macros win us anything that inline functions don’t, besides extra difficulty in debugging and readability?

Photo © Thristian, cc-by-sa.

Published by

Thomas Thurman

Mostly themes, triaging, and patch review.