cplusplus.com
C++ : Forum : UNIX/Linux Programming : : operator (colon)
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


question : operator (colon)

darkestfright (798)
Alright, I've been doing some Gtk+ development as of late, and I've been going over the documentation of certain enumerations and structs in the library. I came across the follow struct, and I'm not very clear on what some of the variables definitions mean:

1
2
3
4
5
6
7
8
9
typedef struct
{
  GtkWidget *widget;
  guint16 padding;
  guint expand : 1;
  guint fill : 1;
  guint pack : 1;
  guint is_secondary : 1;
} GtkBoxChild;


I'm aware of the : operator used in the ternary ?: operation, but I have never seen it used in a variable definition and I'm not exactly sure what the significance of it is.

Thanks in advance.
jsmith (5804)
It means bitfield.

It means that expand occupies 1 bit, for example.

darkestfright (798)
Alright, so if the expand field only occupies 1 bit, that means I can only store a value of 0 or 1 in that field, and not an entire guint?
kbw (3825)
Correct.
Topic archived. No new replies allowed.