Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!nrl-cmf!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: bitsize() operator (was: The D Programming Language) Message-ID: <7398@brl-smoke.ARPA> Date: 2 Mar 88 18:04:55 GMT References: <2718@mmintl.UUCP> <1988Feb25.202237.8688@utzoo.uucp> <664@viper.Lynx.MN.Org> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 12 In article <664@viper.Lynx.MN.Org> john@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 /* (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.