Unused parameters in copy constructor and assignment

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

maxim
Just popping in
Just popping in
Posts: 10
Joined: Wed Mar 07, 2007 05:09

Unused parameters in copy constructor and assignment

Postby maxim » Fri Mar 09, 2007 05:58

Hi,

Although it seems this forum is not very active, I'm not running out of suggestions about CEGUI development :)

It would be better if parameter names were not declared if they're not used.

Like:

Logger(const Logger& logger) : Singleton <Logger>() {}
Logger& operator=(const Logger& logger) {return *this;}

I would like to have this like:

Logger(const Logger&) : Singleton <Logger>() {}
Logger& operator=(const Logger&) {return *this;}



Cheers

LennyH
Quite a regular
Quite a regular
Posts: 92
Joined: Thu Nov 30, 2006 20:50

Postby LennyH » Mon Mar 12, 2007 14:08

And, when sometime down the line, they do decide to use them? In your example, there is no advantage or disadvantage to either one. It's just a personal preference on what you like to see.

However, there is a clear-cut advantage if, down the line, that parameter is used. It's obviously a pretty minor one, but time is money. Even more importantly if you have to abide by some weird naming conventions that would make more sense to get out of the way when the programmer is actually in that mindset, instead of trying to back fill later.

Kinda like how commenting is best done as you work.

maxim
Just popping in
Just popping in
Posts: 10
Joined: Wed Mar 07, 2007 05:09

Postby maxim » Wed Mar 14, 2007 04:11

LennyH wrote:And, when sometime down the line, they do decide to use them? In your example, there is no advantage or disadvantage to either one. It's just a personal preference on what you like to see.

However, there is a clear-cut advantage if, down the line, that parameter is used. It's obviously a pretty minor one, but time is money. Even more importantly if you have to abide by some weird naming conventions that would make more sense to get out of the way when the programmer is actually in that mindset, instead of trying to back fill later.

Kinda like how commenting is best done as you work.

It's all about reducing warnings. Either that or using a #pragma to disable warnings then.

It's pretty far-fetching to say that declaring a variable name for an empty copy constructor would result a clear-cut advantage down the line :) After all it's a good C++ habit not to declare variable name if you are not going to use it.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 4 guests