-
Empty #define
I did a quick search but did not really find an answer to my concern. In my software I would like to:
#define INPUT
#define OUTPUT
As empty #defines. The purpose is to use them in function definitions to clearly indicate what arguments are meant for input/output. So:
STATUS Pop(INPUT QUEUE* Queue, OUTPUT NODE* Node);
The compiler did not complain but I am curious if there are any caveats I should be aware of.
-
INPUT and OUTPUT aren't very unique phrases for a define, and I don't see how this helps programmers any more than a comment would.
-
Arguably, a better place would be in the comment (especially if you use say Doxygen).
A comment would actually tell you what it did, and what to expect.
Code:
/**
* Pop - removes an element from the near end of the queue
* [in] Queue - the queue
* [out] Node - the result
*/
STATUS Pop(INPUT QUEUE* Queue, OUTPUT NODE* Node);
Being "compiled", they're subject to all sorts of namespace issues. Being awfully generic names, you could have problems if you have to integrate with some other package which really uses those symbols for something completely different.
Of the people who use this technique, there's no standard naming convention which might prove useful.