RFC: size-saving boolean type for busybox
Denis Vlasenko
vda.linux at googlemail.com
Tue Jan 2 16:57:58 UTC 2007
Hi people,
I am thinking about introducing a boolean type for busybox.
In C people usually use int, but it takes 4 bytes of data
or bss when you have global flag variable.
C99 has _Bool and on i386 it really takes 1 byte,
at least with gcc 4.1.1 -Os, but I am hot sure about
other versions and especially other arches.
OTOH, there are CPUs which _really_ have hard time
dealing with 1-byte integers (generated code is much bigger),
so using uint8_t as "standard" type for a flag variable isn't ok.
How about this?
#if defined(i386) /* || defined(...) as needed */
typedef unsigned char bbool;
#else
typedef unsigned bbool;
#endif
--
vda
More information about the busybox
mailing list