What Exactly Is Data and How Does It Work?

  • Thread starter Thread starter hkhil
  • Start date Start date
  • Tags Tags
    Data Earth
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
35 replies · 6K views
Yeah sorry eNathan, bytes are simply a common currency in common use, but by no means the only practically used unit.
 
Physics news on Phys.org
-Job- said:
Booleans take up 1 bit. I can store up to two 16 booleans in two bytes. (16 booleans / 16 bits= 1 bit) If i only want to store a single bit then i might not have the choice because data storage is not partitioned by individual bits. But that's a formality. Many times it's the bits, and not the bytes, that will affect the program flow.

eNathan's point is that most programming languages (C included) actually use an entire byte for each variable of type bool. The reason, of course, is that the processor is generally design to operate on bytes. Programs which use individual bits must include code to pack and unpack those bits, which slows the program down.

Note that some processors, notably microcontrollers, do provide instructions to operate on individual bits, but these are rarely available in microprocessors.

The following piece of C code demonstrates that my compiler (gcc 3.4.4) uses an entire byte to store a bool:

Code:
#include "stdio.h"

int main()
{
        printf("sizeof(bool) = %d", sizeof(bool));
}

Several people, eNathan included, are making rather semantic arguments in this thread. A boolean value certainly contains no more than a single bit of actual information; on the other hand, a boolean value may occupy an entire byte (or more) of memory, simply because the resulting program runs faster.

- Warren
 
eNathan's point is that most programming languages (C included) actually use an entire byte for each variable of type bool. The reason, of course, is that the processor is generally design to operate on bytes. Programs which use individual bits must include code to pack and unpack those bits, which slows the program down.
That may be true, but his statement is still not correct. The word bit is used many times when referring to data, especially in other area's of Information Technology out-with Programming. Anyway yes this thread is a bit semantical :biggrin:
 
I think data is an abstraction. It is meaningless, by itself, but definable within a system. data in a computer, is whatever we define it to be.
 
theName() said:
I think data is an abstraction. It is meaningless, by itself, but definable within a system. data in a computer, is whatever we define it to be.
This is quite true.

Sometimes someone will ask me what particular file is that they don't recognize and can't open with any known program. I suggest they open it in Notepad to see what's in it.

They look surprised "You can do that?"

"Of course (though it might appear to be gobbledegook). All bytes are merely 0-255; it is merely a matter of how they are interpreted. Notepad happens to assign them ASCII letters. Another program might assign them colours. Regardless, they're still just 0-255. The file is interpretation-agnostic. It doesn't know how its data will be interpreted by any given program (although the file can make suggestions, such as "my data is only meaningful as ASCII")

Information = data with meaning.
 
Last edited: