C++ Logo

std-proposals

Advanced search

Re: [std-proposals] explicit this

From: Bo Persson <bo_at_[hidden]>
Date: Mon, 3 Apr 2023 12:04:31 +0200
On 2023-04-03 at 10:32, Frederick Virchanza Gotham via Std-Proposals wrote:
> Sometimes when I'm reading through another person's implementation of
> a class, I see function calls inside member functions:
>
> void SomeClass::SomeFunc(void)
> {
> SomeOtherFunc();
> }
>
> When I first see this code, I don't know if SomeOtherFunc is a member
> function, or whether it's a member datum (i.e. a function pointer), or
> whether it's a global function.
>

You already have the option to mark global functions with the scope
resolution operator.

void SomeClass::SomeFunc(void)
{
      ::SomeOtherFunc();
}

Then the rest must be members, right?


I really don't like to have the compiler enforce local coding
conventions. There are other tools for that.

Received on 2023-04-03 10:04:37