[gmx-developers] Questions for clean Gerrit submissions

Teemu Murtola teemu.murtola at gmail.com
Sat Apr 1 06:40:11 CEST 2017

On Sat, Apr 1, 2017 at 1:56 AM Erik Lindahl <erik.lindahl at gmail.com> wrote:

> On Sat, Apr 1, 2017 at 12:31 AM, Eric Irrgang <ericirrgang at gmail.com>
> wrote:
>  * Is there a Gromacs convention for dealing with unused
>    parameters in polymorphic methods to avoid compiler warnings
>    and potential waste?
> "gmx_unused" is available, but don't go overboard with it. If you start to
> need it for more than a single parameters the method/class should probably
> be split into something simpler instead.

On this particular topic, I would rather use the following approaches in
new code (in a decreasing order of preference):

   - Comment out the parameter name in the method declaration (if it is
   never used). This makes it very clear that the parameter is not used, since
   the compiler enforces it.
   - Use GMX_UNUSED_VALUE() if you need the parameter name for Doxygen
   (probably rare for polymorphic methods, since the base interface should
   document them), or if the parameter is unused only on some conditional
   compilation paths; the macro can make this explicit.
   - Use gmx_unused if nothing else works.

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20170401/94a68359/attachment.html>

More information about the gromacs.org_gmx-developers mailing list