Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 355
Toby Avatar asked Aug 22 '26 19:08

Toby


1 Answers

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

like image 161
lucasg Avatar answered Aug 24 '26 10:08

lucasg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!