Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Re: Why does struct user_settings use ints when chars would do?

Re: Why does struct user_settings use ints when chars would do?

From: Björn Stenberg <bjorn_at_haxx.se>
Date: Tue, 6 May 2003 08:53:54 +0200

TP Diffenbach wrote:
> So if these variables all hold values in the range of unsigned char
> (or less), why are they taking up sizeof( int ) bits?

Simply because the struct is a logical representation of the data, rather than a physical one. Numeric variables are thus stored in integers.

Using a consistent type also makes things like set_integer() possible.

We waste perhaps 100 bytes for data, but gain them back in simpler code.

-- 
Björn
Received on 2003-05-06

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy