CHAR or DWORD?

Started by
13 comments, last by TUna 23 years, 11 months ago
MSVC maps long double to 64 bits instead of 80 in 32 bit mode according to online help, in other words, in any windows or console application. I had to code a 128 bit IEEE class for a recent project I was in charge of, when 80 bits would''ve sufficed just fine. If anyone knows how to enable 80 bit long doubles in MSVC, please let me know.

-goltrpoat

--
Float like a butterfly, bite like a crocodile.

--Float like a butterfly, bite like a crocodile.
Advertisement
The memory size of the types are compiler/system/etc. dependent anyway. If anyone wants needs to say how big a certain type is, they need to specify what compiler/interpreter they are using (although I don''t think anyone is talking about VB here, or JAVA).

How is that for a picky comment? But the speed will be different for each processor because of reasons already mentioned. Thanks for reading. 2 cents over.

Phil
While a bool by itself takes up one byte, you can take advantage of the fact that it needs only one bit by using one of the std c++ classes (I can''t remember the name, but its in Stroustrup''s book) that puts eight bools in a byte. Of course, this is only useful if you are using a bunch of bools, but the small time overhead should be better than the massive amounts of memory you would waste using an 8bit or 32bit bool.
So back to my original post, it is better to use CHAR instead of a DWORD where you for a higher chance of a cache hit? Or will MSVC automatically convert it to a DWORD?
a bool is always at least the size of a char..

in fact.. the sizes of all the types are defined as multiples of the size of a single char

in any case..

no type has a ''sizeof'' smaller than a char

and on a pc, a float is 32 bits, double is 64, and long double is 80...



adamm@san.rr.com
adamm@san.rr.com

This topic is closed to new replies.

Advertisement