mercredi 9 mars 2022

Should small utility functions be split into header & source files or just add inline keyword?

I have some small utility functions (< 20 lines of code per function) that I am currently putting in a utils.h file with the keyword inline in front of them so I don't run into multiple definition linking errors. This is what I have always done for small functions.

I am wondering what the advantages and disadvantages are to:

  1. Using my method

  2. Putting the function declarations in utils.h and definitions in utils.cpp

Aucun commentaire:

Enregistrer un commentaire