I don’t think you understood what was done. The prototype signature was not changed in any way. In fact a C++ prototype does not require parameter variable names at all, just the parameter types. Furthermore, the member function definition in the class wasn’t touched, only the implementation.

 

As I’ve pointed out to Lorenz, this is fairly common practice in the C++ world and isn’t usually annotated since most know what it means. I only added the comment since Lorenz requested an explanation, which I provided and he accepted.

 

Seems to me that:

 

ssize_t

PX4IO::write(file * /* filp */, const char *buffer, size_t len)

 

Is easily as clear, less verbose and pedantic than:

 

ssize_t

PX4IO::write(__attribute__((unused)) file * filp, const char *buffer, size_t len)

 

Which is GCC specific and not portable.

 

From: px4dev [mailto:notifications@github.com] 
Sent: Saturday, August 17, 2013 2:53 PM
To: PX4/Firmware
Cc: Jean Cyr
Subject: Re: [Firmware] Flesh out PX4IO documentation comments and delete unnecessary class var (#361)

 

In src/drivers/px4io/px4io.cpp:

> @@ -1628,7 +1667,8 @@ class PX4IO : public device::I2C
>  }
>  
>  ssize_t
> -PX4IO::write(file *filp, const char *buffer, size_t len)
> +PX4IO::write(file * /*filp*/, const char *buffer, size_t len)
> +/* Make it obvious that file * isn't used here */

Please don't do this. If a prototype conforms to a public interface (like this one), please keep the signature identical (including the naming of the arguments). If a private interface has an unused argument, remove it.

The fact that you need a comment to explain your comment should be a warning flag. 8)

IFF the compiler is complaining about unused arguments, decorate them in the declaration with the appropriate attribute.

—
Reply to this email directly or view it on GitHub <https://github.com/PX4/Firmware/pull/361/files#r5829549> .  <https://github.com/notifications/beacon/mZHFuVAGpjKMu8Zke4leWAICZGQ18f9Cyb9neeugRvGbjPG6Fe8_5QarQbIkBFLK.gif>