Skip to content

How should I handle name collisions from class variables to function variables and locals? #91

@namrog84

Description

@namrog84

This is an arbitrary example but let's say I have a funciton

void SomeClass::SetTarget(AActor* InTarget){
    Target = InTarget;
    ...
    AActor* localTarget = Target; // is local the right prefix for this?
    ...
}

Traditionally in previous teams I've always named the member variable as m_target in this case but I know that's not recommended. I have seen some instances of Epic using My as a prefix but that sometimes doesn't look right either.

I could rename the function parameter to be (AActor* InTarget)

Then what about if I need a local function variable do I name that localTarget?

I've yet to find consistent unreal specific guidelines for dealing with these 3 scopes since I thought I read that using this-> isn't typically recommended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions