0

I have been trying to improve my understanding of C/C++ but looking at includes for functions, such as printf, which I use a lot. However I am running across a syntax which I am not familiar with, nor am I able to find. What does the ':' mean? For example:

unsigned int is_long_double:1;

It seems that it would be some type of precursor to the boolean expression.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
mreff555
  • 1,049
  • 1
  • 11
  • 21

1 Answers1

2

It defines the variable as a bitfield of length 1 bit.

It's only valid in a struct, and only makes sense if you have multiple bitfields together.

Don't use it as a generic boolean because it doesn't save memory - a single bitfield on its own will still take up a full word of memory.

Paul Tomblin
  • 179,021
  • 58
  • 319
  • 408