Replies: 1 comment 1 reply
-
As they are "static inline" the declared functions will only consume executable space if they are used in the current translation unit (otherwise they are simply gone). You can use the global macros On another work, I plan to integrate a new version of a "shared pointer" interface which would allow full encapsulation of data (you will have separate declaration and definition). |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm new to c and I'm wondering how this library will behave if I need to declare a type in a header file to be used in several translation units afterwards, something like forwarded data (in this library, as I know all generated types are reference types of sorts)?
As I understand now, if I make LIST_DEF(name, int) in the header file, it creates the same set of functions in each translation unit, as they are kind of declared as static inline and it can lead to code growth and hence file growth? (I hope I understand correctly how this all works).
If it works like that, why not create a macro that can just generate the declarations and the definitions the user would be required to generate in the .c file? What do you think of the idea? If I'm wrong, please ask me to correct me
Beta Was this translation helpful? Give feedback.
All reactions