Re: [dev] [dwm][st] why use ints over bools?

From: Pontus Stenetorp <pontus_AT_stenetorp.se>
Date: Sat, 15 Jun 2024 21:03:29 +0900

On Sat 15 Jun 2024, Zac wrote:
>
> In a number of spots in dwm and st I've seen the use of integers as booleans. e.g.
> - dwm.c line 95, 140, 1870
> - drw.c line 252
> - st.c line 44, 48
>
> That's not an extensive list; just some examples.
>
> I'm curious why you use ints though. Because bools are 31 bits smaller than ints, which is 31 bits of memory saved. Not that 31 bits is very much, but still...

You may want to refer to a textbook or make an online search about that assumption. On every architecture I have worked with, it would be *at least* a byte.
Received on Sat Jun 15 2024 - 14:03:29 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 15 2024 - 14:12:08 CEST