Skip to main content
27 events
when toggle format what by license comment
Apr 18 at 17:56 answer added Brian Goetz timeline score: 6
Apr 13 at 14:05 comment added user3840170 @rydwolf Those are orthogonal – struct S {}; in C++ has non-zero size, but no members; struct S<'a>(PhantomData<&'a ()>); in Rust has a member, but zero size.
Apr 7 at 22:01 answer added Kamilla timeline score: 1
Feb 25 at 14:37 comment added Pablo H More Rust info on ZST in The Rustonomicon.
Jul 26, 2024 at 0:06 answer added Adam Gausmann timeline score: 7
Jul 6, 2023 at 18:01 answer added Seggan timeline score: 4
Jul 5, 2023 at 0:32 answer added Mike Samuel timeline score: 2
Jul 3, 2023 at 20:46 comment added Bergi Re Rust, have a look at What are the differences between the multiple ways to create zero-sized structs?
Jul 3, 2023 at 12:06 answer added Matthieu M. timeline score: 9
Jul 2, 2023 at 22:47 comment added leftaroundabout Why would a language not allow zero-size structs?
Jul 2, 2023 at 21:25 answer added Patrick Stevens timeline score: 7
Jul 2, 2023 at 16:01 comment added rydwolf @user3840170 For this question, both for the most part. I'm used to making the assumption zero members == zero size, so I kind of worded the question around that, but answers talking about non-zero-size ones would still probably be useful tho.
Jul 2, 2023 at 14:41 review Close votes
Jul 2, 2023 at 16:47
Jul 2, 2023 at 14:19 comment added user3840170 Are you asking about why it is allowed for a struct to have no members (like in C++), or are you asking about why it has zero size?
Jul 2, 2023 at 9:18 answer added feldentm timeline score: 8
Jul 2, 2023 at 0:25 comment added chbaker0 @user16217248-OnStrike void in C is not inhabited in the same sense: an expression or function has type void but you cannot construct and pass around a value of type void. In Rust, a ZST mostly behaves like other types: you can have a value of type () or any other ZST. A !Copy ZST has the same ownership semantics of other types.
S Jul 1, 2023 at 19:02 history suggested Karl Knechtel CC BY-SA 4.0
simplify title
Jul 1, 2023 at 18:00 answer added Chester Gillon timeline score: 7
Jul 1, 2023 at 15:36 review Suggested edits
S Jul 1, 2023 at 19:02
Jul 1, 2023 at 15:11 answer added chux timeline score: 4
Jul 1, 2023 at 12:08 history became hot network question
Jul 1, 2023 at 11:00 answer added mousetail timeline score: 23
Jul 1, 2023 at 6:04 comment added CPlus Follow up question: How would a zero-size struct be different from void in practice?
Jul 1, 2023 at 4:28 answer added Barmar timeline score: 39
Jul 1, 2023 at 4:21 answer added bigyihsuan timeline score: 4
Jul 1, 2023 at 4:09 answer added Bbrk24 timeline score: 18
Jul 1, 2023 at 4:06 history asked rydwolf CC BY-SA 4.0