Questions tagged [unit-type]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
26 votes
8 answers

What are the pros and cons of having a unit type over C-like void?

Unit types are types found in more modern languages, replacing void in the C-family languages. Unlike void, a unit type has an ...
Seggan's user avatar
  • 2,603
21 votes
11 answers

Why would a language allow zero-size structs?

While scrolling through a Rust syntax cheat sheet today, I noticed an odd item: struct S; // Define zero sized unit struct. Occupies no space, optimized away. This ...
Rydwolf Programs's user avatar