Toby
Toby

Reputation: 10154

How can I document optional parameters

My function has a different parameter list depending on if a device feature is enabled via a #define constant SMBSUS_INH

e.g.

#ifndef SMBUS_INH
    handle initHandle(foo_t foo, SMB_Info_t smbInfo, bar_t bar);
#else
    handle initHandle(foo_t foo, bar_t bar);
#endif

How can I correctly document this?

If I write the documentation, twice, once inside each of the #if...else clauses will doxygen ignore the irrelevant one? Or will it still see bothe documentation blocks and complain that one has no related function?

Is there a better way of managing this? Thanks.

Upvotes: 3

Views: 943

Answers (1)

lucasg
lucasg

Reputation: 11012

Doxygen does some partial preprocessing : if you put specific documentation in the if/else part, only the relevant documentation will be shown. However, is it really a good thing ? As a user, I may be interested in seeing every different prototype, even though disabled at compile-time.

source : http://www.doxygen.nl/manual/preprocessing.html

Upvotes: 2

Related Questions