[gmx-developers] Questions for clean Gerrit submissions

Eric Irrgang ericirrgang at gmail.com
Tue Apr 4 04:42:16 CEST 2017

Thank you for the tips, Teemu, and Erik,

gmx_unused is what I was looking for to subclass a Gromacs abstract class
with fewer requirements. I had trouble simply commenting out the unused
parameters for pure virtual methods, but I am also curious why the the
'unused' attribute macros are not the preferred approach or even marking
them void in the definition?

I used commit b57307c233 from the 'gromacs' branch of uncrustify from git://
github.com/rolandschulz/uncrustify.git but constructor member
initialization lists still seemed to get confused by brace initialization,
at least for certain argument types. I didn't require brace initialization
so I switched to traditional syntax, but I wonder whether there is an
option I was missing or if this is just a matter of limited logic in


On Sat, Apr 1, 2017 at 12:39 AM, Teemu Murtola <teemu.murtola at gmail.com>

> 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,
> Teemu
> --
> Gromacs Developers mailing list
> * Please search the archive at http://www.gromacs.org/
> Support/Mailing_Lists/GMX-developers_List before posting!
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
> or send a mail to gmx-developers-request at gromacs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20170404/03542996/attachment.html>

More information about the gromacs.org_gmx-developers mailing list