C++ Logo

std-discussion

Advanced search

Re: Does the statement "The postfix expression before the dot or arrow is evaluated; 63 the result of that evaluation..." applies to overloaded operators also

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 10 May 2023 12:30:52 -0700
On Wednesday, 10 May 2023 03:56:38 PDT Edward Catmur via Std-Discussion wrote:
> Why do you ask? Under what circumstances do you think the left operand
> might not be evaluated?

Do note it is evaluated even if you call a static function.

struct S
{
    static void f();
};
void f(S *p)
{
    p->f(); // it is evaluated, so p had better not be null
}

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-05-10 19:30:53