Should structures be typedef'd in the C library?

Firstly, I am familiar with the concepts of using typedefboth anonymous and structs for both names . My question is how the C library should expose its types.

Typically, I am just typedefanonymous structor named structwhen I need a forward ad. However, this is a problem if the library, in which there is only one typedef, is included in the project, which prefers to use a qualifier struct, which is no longer possible. Likewise, having both a typedefname and a name structcan still pollute the common namespace for such projects.

If the library should provide only named structures and leave it to the typedefuser?

+4
source share

Source: https://habr.com/ru/post/1657797/


All Articles