Hacker News new | ask | show | jobs
by fiedzia 3368 days ago
Yes, but nothing will stop you from casting pointer to meters into pointer to yards, while many C features force or encourage this behaviour. You also cannot override operators for combining those units. And the value is still just int.
1 comments

> casting pointer to meters into pointer to yards, while many C features force or encourage this behaviour.

What C feature forces or encourages casting Meters* to Yards*?

> You also cannot override operators for combining those units.

The lack of operator overloads has nothing to do with typesafety. There are languages which are considered typesafe and which do not have operator overloading.