Xref: utzoo comp.lang.c:5541 comp.lang.c++:586 Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: Binary integer literals Message-ID: <7543@elsie.UUCP> Date: 12 Dec 87 01:15:32 GMT References: <2752@super.upenn.edu> Organization: NIH-LEC, Bethesda, MD Lines: 44 Keywords: binary, integer, literal Summary: cpp to the rescue > Wanted: a way to declare binary constants! > Arrays of binaries intended as bitmaps are much easier to read and edit > than arrays of hex declarations. . . > > static unsigned short CursorPattern[16] = { > 0xff00, /* 1111111100000000, */ > 0x8200, /* 1000001000000000, */ > ... #include#define __ ((((((((((((((((0 #define _ <<1|0) #define X <<1|1) static unsigned short CursorPattern[16] = { __ X X X X X X X X _ _ _ _ _ _ _ _ , __ X _ _ _ _ _ X _ _ _ _ _ _ _ _ _ , __ X _ _ _ _ X _ _ _ _ _ _ _ _ _ _ , __ X _ _ _ _ _ X _ _ _ _ _ _ _ _ _ , __ X _ _ _ _ _ _ X _ _ _ _ _ _ _ _ , __ X _ X _ _ _ _ _ X _ _ _ _ _ _ _ , __ X X _ X _ _ _ _ _ X _ _ _ _ _ _ , __ X _ _ _ X _ _ _ X _ _ _ _ _ _ _ , __ _ _ _ _ _ X _ X _ _ _ _ _ _ _ _ , __ _ _ _ _ _ _ X _ _ _ _ _ _ _ _ _ , __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ , __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ , __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ , __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ , __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ , __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ }; main() { int i; for (i = 0; i < sizeof CursorPattern / sizeof CursorPattern[0]; ++i) (void) printf("%04x\n", CursorPattern[i]); return 0; } -- ado@vax2.nlm.nih.gov ADO, VAX, and NIH are Ampex and DEC trademarks