What happens to the rest of memory address space if the data is less than 1 byte?

Sorry if this sounds like a stupid question I’m very new to this.

So my question is; within modern computers memory address space is a byte long, so what would happen to the rest of the address space if left unused as some data types like booleans use 1 bit of space.

I understand slack space within other block devices, but I’m not sure if it would be similar.

Detailed answers about what actually happens under the hood would be greatly appreciated.

0

While all true and interesting in the context, Doc Brown’s answer does not addresses the question the way I interpret it. The point is, in any microprocessor a byte is the smallest writable data unit. So whether you only care about a single bit or about all 8 bits, you will write 8 known bits for each byte. There is no such thing as missing bits or empty bits.

The programming language may hide the bits you don’t care about for you or only use one particular bit when it comes to interpreting a value but the other bits will still be set explicitly by the machine code instruction that writes the byte.

So, in other words… The programming language (whichever) presents a model. It implements that model using whatever the machine has to offer. Note that on the machine level there are no data types, just bits that are writable in chunks of 8.

This makes your question moot. The machine does not know whether the byte it writes is (part of) a boolean or a character or a floating point value. This information is not in the data itself, the data is just bits. The executed program (or rather the programmer or compiler) knows that that particular byte at that address represents a boolean value and will interpret it as such, ignoring bits that are irrelevant to the type.

7

The exact behaviour depends on the specific programming language implementation (the compiler or interpreter and its version), and the specific platform.

For almost any higher-level programming language environment I have worked with over the last ~40 years which had something like a specific boolean type (which excludes assembly languages or Microsoft Basic V2), the standard memory size for an unpacked boolean variable was 1, 2, 4 or 8 bytes. A “false” value is usually mapped to the integer equivalent of zero (so all bits within the byte or bytes set to zero), and a “true” value either to a representation equivalent to an integer “1”, with exactly one bit set to “one”, all others to zero, or a representation equivalent to “-1”, where all bits are set to “one”. I have also worked with representations where “false” was mapped to the one-byte ASCII character ‘0’ (= decimal 48 = 00110000 binary), and “true” to the one-byte ASCII character ‘1’ (= decimal 49 = 00110001 binary), and maybe some others I probably forgot. It is also not uncommon in certain programming languages like C to interpret every number different from zero as boolean “true”.

Of course, most programming language environments allow to use (or provide) datatypes for arrays of booleans which are packed in some form, so to put up to 8 boolean values into a byte.

Let me add I am pretty sure there exist some other language environments with different conventions, but I guess those are not really “mainstream”. You will find some further information for several different languages here: Rosetta Code – Boolean values. For more information about the low-level functionality of computers, you may have a look into “How Do Computers Work?”.

5

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật