News for hackers. Stuff that matters.
Re:Let the Type System do the Work by tutuca on Monday April 21, 2014 @02:27PM (#7622701)
or good ol' typedef, no?
Re:Let the Type System do the Work by masklinn on Monday April 21, 2014 @03:15PM (#7623044)
With a straight typedef, you can add 3 feet to 5 meters and get 8. Probably not desirable. So you've got to typedef single-field structs instead.
Re:Let the Type System do the Work by dllthomas on Tuesday April 22, 2014 @06:25AM (#7626784)
"So you've got to typedef single-field structs instead."

Which, thankfully, don't add any runtime cost (as should be expected).

As an aside, you don't actually need to typedef them at that point, but it saves you having to write "struct ..." everywhere so it's typically worthwhile.

Re:Let the Type System do the Work by steveklabnik on Monday April 21, 2014 @03:04PM (#7622968)
Sure, but typedefs aren't as strong a guarantee. They're more a textual find/replace than an actual feature of the type system.