Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Special Data Type Declaration and Usage Date: Wed, 16 Nov 2011 10:09:22 +1300 Lines: 15 Message-ID: <9ig2o7Fi5oU5@mid.individual.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net athTDrflbHQ3uDRl2N5gUwaJ6E5ORuli8nvMh5RRXfcpzdnrg8 Cancel-Lock: sha1:OJCQ/AHH00CmL0DfHZnrVXvA+QQ= User-Agent: Mozilla/5.0 (X11; SunOS i86pc; rv:6.0.2) Gecko/20111003 Thunderbird/6.0.2 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:11484 On 11/16/11 10:04 AM, Mike Copeland wrote: > I need to declare an enormous array (100,000 members) of a small > scalar object, and I want to populate it with default values and change > some of them as needed throughout the processing. The range of distinct > values for each element is 0-15, so I could use a 4 bit "mini-byte" if > something like that existed. > My question is: can I declare a bit structure data type and use it > this way? If that's possible, I don't know how to do so, nor how I'd > manipulate the data values in it. Please advise. TIA You can't have a single type smaller than a char. You could put a pair of your "mini-byes" in a bit-field. -- Ian Collins