TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALEXANDER DERAZHNE
from: HERMAN SCHONFELD
date: 1997-03-30 08:03:00
subject: Bit Fields

AD>Hello, dear Herman!
AD>Sunday March 23 1997 09:15, Herman Schonfeld wrote to Rick Bischoff:
 RB>> Does anyone know how to declare a variable that holds only one bit
 RB>> of information.. (You know only two values (0 or 1)) ???
 HS> struct  bit_field {
 HS>         int bit_1        : 1;
AD>                                 ^
 HS>         int bits_2_to_5  : 4;
AD>             ^^^                 ^
 HS>         int bit_6        : 1;
AD>             ^^^                 ^
 HS>         int bits_7_to_16 : 10;
AD>             ^^^
 HS> } bit_var;
AD>    I'm afraid, it wrong. First three lines requred comma (',') instead
AD>of
AD>semicolon (';'), then, type declarations ("int") in last lines must be
AD>absent.
That was taken out of my own compilable code.
AD>Alexander
... I like the 486 tower. Does it come in red?
--- Ezycom V1.48g0 01fd016b
---------------
* Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.