unused variables
Moderators: CEGUI MVP, CEGUI Team
Re: unused variables
Thanx!
Re: unused variables
Btw isn't
enough to suppress the warning for practially all compilers?
If yes then i absolutely oppose introducing the macro which requires to have an additional line for each function for each parameter. Also the above solution is already done in CEGUI in some instances.
Code: Select all
void func(AwesomeClass& /* param1 */)
{
// Some code that doesn't use param1
...
}
enough to suppress the warning for practially all compilers?
If yes then i absolutely oppose introducing the macro which requires to have an additional line for each function for each parameter. Also the above solution is already done in CEGUI in some instances.
CrazyEddie: "I don't like GUIs"
Re: unused variables
Ident: This will work for most of the cases, and I have no objection using it. However, there are still 2 cases where this won't work, and then I suggest still using a macro:
1) When the unused variable is not a parameter. Say it's a local variable, e.g.
In Release build you'll get a warning that "is_success" is undefined.
2) When the variable is only used in a preprocessor conditional block:
Which with the macro will become:
Plz tell me if u approve this.
1) When the unused variable is not a parameter. Say it's a local variable, e.g.
Code: Select all
bool is_success(myFunc());
assert(is_success)
In Release build you'll get a warning that "is_success" is undefined.
2) When the variable is only used in a preprocessor conditional block:
Code: Select all
void myFunc(int myVar)
{
#if defined SOMETHING
cout << myVar;
#endif
}
Which with the macro will become:
Code: Select all
void myFunc(int myVar)
{
#if defined SOMETHING
cout << myVar;
#else
CEGUI_UNUSED(myVar);
#endif
}
Plz tell me if u approve this.
Re: unused variables
I approve it only for usage in the two cases you mentioned. In any other case the parameter identifier should be commented out.
CrazyEddie: "I don't like GUIs"
Re: unused variables
Ok, that's what I meant.
Return to “CEGUI Library Development Discussion”
Who is online
Users browsing this forum: No registered users and 3 guests