| www.delorie.com/djgpp/mail-archives/browse.cgi | search |
| From: | "Böhme Uwe" <uwe AT hof DOT baynet DOT de> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: short int and unsigned char |
| Date: | Fri, 31 Jul 1998 05:40:04 +0200 |
| Organization: | Bingo (Buergernetz Ingolstadt eV) |
| Lines: | 22 |
| Message-ID: | <35C13C93.27DEF5B@hof.baynet.de> |
| References: | <199807302138 DOT XAA10684 AT d1o22 DOT telia DOT com> |
| NNTP-Posting-Host: | port62.hof.baynet.de |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
> I wonder how big a short int is (in bits) and if there are anything smaller > then an unsigned char (1, 2, 4 bits). I also wonder if there is any command > to read and write a single bit in a variable. > > Thanks in advance. I don't know weather there are packed bit arrays in ANSI. But one thing is clear. Even if there are, in most cases it's not very usefull (with very rare exception)' cause for the iXX processor there is no way to set a single bit despites the regular way with and(&) and or (|) and so you can do in C also. The sizeof operator will allways give you the size of the variable you are using. The n'th bit you get by (1<<n); You can set it by var|=(1<<n); You can wipe it by var&=~(1<<n); So why messing around with bitwise variables. Uwe
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |