Consider a large project, where many types are typedef
\'d, e.g.
typedef int age;
typedef int height;
and some functions gettin
There is no built-in support for this in GCC.
There is a feature request to add this, based on the Sparse nocast
attribute. However, this hasn't been implemented. If you can use Sparse, though, you could do this by marking each typedef with __attribute__((nocast))
.
In C++ you can do this by making wrapper classes rather than typedefs, and then simply not defining implicit conversions for them.