Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memmap/PowerPC: Remove unnecessary const on function declaration parameters #5032

Merged
merged 2 commits into from Mar 7, 2017

Conversation

lioncash
Copy link
Member

@lioncash lioncash commented Mar 6, 2017

Both the following function declarations are equivalent:

void SomeFunction(int value);
void SomeFunction(const int value);

Const when used on direct value types (or rhs of a pointer like u8* const), only applies within the definition of a function, and not its declaration.

e.g.

// Header
void CalculateSomething(int lhs, int rhs);

// Definition
void CalculateSomething(const int lhs, const int rhs)
{
  // lhs and rhs can't accidentally be modified
}

This just cuts down a bit on line noise.

const, when used on value type parameters in the declaration,
is superfluous. This doesn't really convey any information to take note
of when using the function. This only matters in the definition when you
want to prevent accidental modification.

e.g.

// Header
void CalculateSomething(int lhs, int rhs);

// Definition
void CalculateSomething(const int lhs, const int rhs)
{
  // lhs and rhs can't accidentally be modified
}
@Parlane Parlane merged commit 4d02d38 into dolphin-emu:master Mar 7, 2017
@lioncash lioncash deleted the const branch March 7, 2017 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants