Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: boolean usage |
| Date | 2011-05-16 08:09 -0700 |
| Organization | None to speak of |
| Message-ID | <lnzkmmfzrg.fsf@nuthaus.mib.org> (permalink) |
| References | <1e11781e-486c-414d-acbc-7d6447000270@f9g2000vbz.googlegroups.com> <oqpvs65m9oual4tldng627nj8vt9a0qi97@4ax.com> |
Datesfat Chicks <datesfat.chicks@gmail.com> writes:
[...]
> I do embedded work with small micros (2K of RAM is a high-end part for
> me), so every bit has to count.
>
> I typically use _Bool_ or _Boolean_ (forget what the right keyword
> is). Anyway, that does a few neat things in the development tools:
>
> a)It causes the linker to manage RAM at the bit level (rather than the
> byte level). So you can link a bunch of modules together each with
> _Bool_'s, and variables from different modules are actually often in
> the same byte. No RAM wasted! The tools pack the bits.
[...]
Either your tools are generating C code that emulates 1-bit objects
using either bit fields or bitwise operations, or your C compiler
is non-conforming. In standard C, if you apply sizeof to an object,
type, or expression of any type, the result is at least 1 byte,
which is at least 8 bits. (sizeof can't be applied to bit fields.)
This is just an observation; I don't suggest that there's anything
wrong with a non-conforming implementation. But I don't think your
situation is an argument for or against using _Bool in standard C.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
boolean usage "dr.oktopus" <blindwilly@freeonline.zzn.com> - 2011-05-14 14:05 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-14 16:41 -0700
Re: boolean usage Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-15 04:18 +0100
Re: boolean usage "dr.oktopus" <blindwilly@freeonline.zzn.com> - 2011-05-14 23:12 -0700
Re: boolean usage Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-05-14 23:39 -0700
Re: boolean usage "Bill Cunningham" <nospam@nspam.invalid> - 2011-05-19 21:29 -0400
Re: boolean usage Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-05-19 22:49 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-20 09:17 -0700
Re: boolean usage gazelle@shell.xmission.com (Kenny McCormack) - 2011-05-20 17:14 +0000
Re: boolean usage Datesfat Chicks <datesfat.chicks@gmail.com> - 2011-05-15 10:58 -0400
Re: boolean usage Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-05-15 08:12 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-16 08:09 -0700
Re: boolean usage Datesfat Chicks <datesfat.chicks@gmail.com> - 2011-05-16 19:44 -0400
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-16 17:46 -0700
Re: boolean usage Datesfat Chicks <datesfat.chicks@gmail.com> - 2011-05-16 22:45 -0400
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-16 18:23 -0700
Re: boolean usage Jens <jens.gustedt@gmail.com> - 2011-05-16 23:37 -0700
Re: boolean usage James Kuyper <jameskuyper@verizon.net> - 2011-05-17 06:39 -0400
Re: boolean usage "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-05-17 09:55 -0400
Re: boolean usage James Kuyper <jameskuyper@verizon.net> - 2011-05-17 21:17 -0400
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-17 16:50 -0700
Re: boolean usage Jens <jens.gustedt@gmail.com> - 2011-05-18 09:21 -0700
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-18 15:36 -0700
Re: boolean usage Jens <jens.gustedt@gmail.com> - 2011-05-19 00:20 -0700
Re: boolean usage Ralf Damaschke <rwspam@gmx.de> - 2011-05-19 09:04 +0000
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-19 01:13 -0700
Re: boolean usage Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-05-19 03:29 -0700
Re: boolean usage Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-19 11:41 +0100
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-19 11:24 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-19 11:55 -0700
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-19 14:40 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-19 15:48 -0700
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-23 18:26 -0700
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-23 18:29 -0700
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-23 18:27 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-24 00:11 -0700
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-24 00:48 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-24 09:16 -0700
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-24 10:10 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-24 10:48 -0700
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-25 10:18 -0700
Re: boolean usage gazelle@shell.xmission.com (Kenny McCormack) - 2011-05-19 21:53 +0000
Re: boolean usage Michael Press <rubrum@pacbell.net> - 2011-05-25 11:22 -0700
Re: boolean usage Kenneth Brody <kenbrody@spamcop.net> - 2011-05-25 16:10 -0400
Re: boolean usage Michael Press <rubrum@pacbell.net> - 2011-05-26 12:32 -0700
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-19 22:39 -0700
Re: boolean usage Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-20 12:57 +0100
Re: boolean usage Peter Nilsson <airia@acay.com.au> - 2011-05-22 17:52 -0700
Re: boolean usage Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-23 13:15 +0100
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-24 00:57 -0700
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-24 01:38 -0700
Re: boolean usage Keith Thompson <kst-u@mib.org> - 2011-05-24 09:20 -0700
Re: boolean usage Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-24 11:00 -0700
csiph-web