Meaning of this declaration?

From: Anand Hariharan (mailto.anand.hariharan_at_gmail.com)
Date: 12/20/04


Date: 20 Dec 2004 14:36:43 -0800

I was reading Coplien's C++ Styles & Idioms, and I came across a
declaration like so -

int var_name : 3;

Unfortunately, the text wasn't going into details of the code, rather,
how C and C++ code differ (and this declaration wasn't one of them).

Not having seen something like this before, I took a moment to review
the standard, and sure enough 9.6 [class.bit] defined this completely.
However, it was all explained in typical legalese, and quite didn't
explain the whys or what-fors.

All insights appreciated,
- Anand



Relevant Pages

  • compiling kernel
    ... scripts/kconfig/qconf.h:51: error: `e' was not declared in this scope ... scripts/kconfig/qconf.h:73: error: `int updateList' redeclared as different ... scripts/kconfig/qconf.h:8: error: forward declaration of `class ConfigList' ... ConfigLineEdit' ...
    (alt.os.linux.suse)
  • DBI install problems
    ... before "bool" ... to `int' in declaration of `Perl_Gv_AMupdate' ... definition has no type or storage class ...
    (perl.dbi.users)
  • make Buildworld fails...why?
    ... type defaults to `int' in declaration of `_nc_tracing' ... data definition has no type or storage class ...
    (freebsd-questions)
  • Compilation problem
    ... "PRIntn" ... no type or storage class ... `int' in declaration of `_PR_MD_GETFILEINFO' ...
    (comp.unix.bsd.freebsd.misc)
  • Re: bug in Real-Time Preemption
    ... lib/rwsem.c:153: warning: type defaults to `int' in declaration of `type name' ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)