Search code examples
c++cconventions

C/C++ function/method decoration


DISCLAIMER: I haven't done C++ for some time...

Is it common nowadays to decorate C/C++ function/method declarations in order to improve readability?

Crude Example:

void some_function(IN int param1, OUT char **param2);

with the macros IN and OUT defined with an empty body (i.e. lightweight documentation if you will in this example). Of course I understand this goes somewhat in parallel with the "doc comment block" associated with the method/function.

Could you provide some other examples... assuming this topic is useful to the community. Please bear in mind that the example above is just what it is.


Solution

  • I wouldn't appreciate such decoration.

    Much better to use const and references and constant references, like in

    void some_function(AClass const &param1, AnotherClass &param2)
    

    Usually int are passed by value and not by reference, so I used AClass and AnotherClass for the example. It seems to me that adding empy IN and OUT would be distracting.