bitsize() operator (was: The D Programming Language)
Doug Gwyn
gwyn at brl-smoke.ARPA
Thu Mar 3 04:04:55 AEST 1988
In article <664 at viper.Lynx.MN.Org> john at viper.UUCP (John Stanley) writes:
>... addition-to-ansi-C of a new operator that would have a similar
>functionality, but which would return the number of -bits- in
>something. The name bitsize() would be my suggested name for this
>operator.
It's already basically there:
#include <limits.h> /* (we may have to rename this header) */
#define bitsize(obj) (CHAR_BIT*sizeof(obj))
The only thing this doesn't work on is bit-fields, functions, or
incomplete types.
More information about the Comp.lang.c
mailing list