-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
…zero-size is not that common
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ assert_eq!(size_of::<U>(), 2); | |
#### Zero-sized fields | ||
|
||
If a `#[repr(C)]` union contains a field of zero-size, that field does not | ||
occupy space in the union. For example: | ||
occupy space in Rust unions (as opposed to, e.g., in C++). For example: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gnzlbg
Author
Contributor
|
||
|
||
```rust | ||
# use std::mem::{size_of, align_of}; | ||
|
Isn't it the case that in C++, there are no types of size 0? In that case, "if a field has size 0, X happens" is a true statement for C++ as well, and vacuously so. IOW, C++ would not be a counter-example to "fields of zero size have size zero".