How many bytes is float?

Started by
11 comments, last by jpetrie 20 years, 2 months ago
quote:Original post by superdeveloper
But yes, in C/C++, a byte is 8 bits wide.


No, the number of bits in a C++ byte is undefined.

Advertisement
quote:Original post by Jingo
No, the number of bits in a C++ byte is undefined.
You mean the number of bits in a C++ char? Because byte is defined to be 8 bits, much like nibble is defined as 4 bits, independ of the platform or the language.
quote:
You mean the number of bits in a C++ char? Because byte is defined to be 8 bits, much like nibble is defined as 4 bits, independ of the platform or the language.


In C++ a char is defined to be one byte. A byte is not neccessarily 8-bits, although for all intents and purposes you are probably safe assuming that nowadays. Likewise, a nybble is defined to be half a byte, not neccessarily four bits.

In any case, I think we''re all agreed that the answer to the OP is sizeof(float), at least in C++.

(I don''t really know if there is an "official" definations for byte, nybble, et cetera, so I''m basically going off of foldoc.org''s entries for the same).

This topic is closed to new replies.

Advertisement