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:36:44 +1300 Lines: 39 Message-ID: <9ig4bcFi5oU7@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 amHKpM5FzroqNaZZnMXTZgIhYxCpcSp3whJemCm2E/9dqd0PVR Cancel-Lock: sha1:R14HXrVx8kz7R1KyAd/qRuwUHX4= 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++:11488 On 11/16/11 10:30 AM, Mike Copeland wrote: > In article, > gennaro.prota+Usenet@gmail.com says... >> On Tue, 15 Nov 2011 22:04:25 +0100, 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 >> >> Are you sure that the array is "enormous"? Using one (whole!) byte per >> element it would occupy less than 100KiB. >> > It's "enormous" to me, as I have many other large data structures in > this program, and I have to declare it globally (it's accessed from a > number of subprograms in several source files). My concern is Heap > allocation, inasmuch as there must be _some_ limit as to how much > program data can be declared before the program chokes. That depends on the configuration (physical and OS) of the target system. > I;m using VS6.0, and I don't know what that limit is. Stop right there! An obsolete, non-standard and buggy compiler? I'm sure you can do better than that. > I was hoping that I could cut down the total size of this data > component and still process it efficiently. It seems not possible... > 8<{{ Yes you could cut down the size, but that is often orthogonal to efficient processing. -- Ian Collins