Search code examples
cgnome

Why it is good practice to define custom datatypes in larger projects


Please help me understand reason of defining C types in some projects.

In my current company I found that someone made definitions of types that are equivalent of those that are already defined in <stdint.h>.

Such approach makes harder to integrate 3party code into project, and makes programmer work, bit more frustrating.

But I can also see that some projects, like gnome do the same. There is a gchar, gsize, and gint32 for example.

Because I don't see ANY reason for such approach, I kindly ask for explanation.

What is the reason that <stdint.h> isn't sufficient.


Solution

  • This is not good practice. It only leads to less compatibility and portability. I don't see any reason that it should be done. stdint.h exists to avoid this.