Since this is just uncommon syntax (at least I haven't seen it before) and it is just used in the declaration I would be ok with it, if an additional comment explains it. It's not a strong opinion though, just an idea.

--Markus


Am 2013-07-14 21:32, schrieb Anselm R Garbe:
On 7 July 2013 16:49, koneu <kone...@googlemail.com> wrote:
In Xdefs.h, Bool is typedef'd as int (= at least 2 bytes, sometimes more, depending on the implementation), of which we set the last bit to 1 or 0. In the Monitor and Client structures dwm uses, we can instead use char bit fields, storing up to 8 Bool values in 1 byte.

diff --git a/dwm.c b/dwm.c
index 314adf4..83af1f6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -91,7 +91,7 @@ struct Client {
        int basew, baseh, incw, inch, maxw, maxh, minw, minh;
        int bw, oldbw;
        unsigned int tags;
- Bool isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + unsigned char isfixed :1, isfloating :1, isurgent :1, neverfocus :1, oldstate :1, isfullscreen :1, :2;
        Client *next;
        Client *snext;
        Monitor *mon;
@@ -121,8 +121,7 @@ struct Monitor {
        unsigned int seltags;
        unsigned int sellt;
        unsigned int tagset[2];
-       Bool showbar;
-       Bool topbar;
+       unsigned char showbar :1, topbar :1, :6;
        Client *clients;
        Client *sel;
        Client *stack;

I find this less readable than the usage of Bool. If memory
consumption would be a major dwm concern, I'd agree with such a
suggestion. But there are more important problems to focus on in dwm
6.1 (fixed xinerama support).

Best regards,
Anselm

Reply via email to