DEV Community

Discussion on: Code Smell 145 - Short Circuit Hack

Collapse
 
eljayadobe profile image
Eljay-Adobe

When I've asked about optional chaining in C++, the push back I've gotten has been that it's a code smell because optional chaining means high coupling and intimate knowledge of the private parts.

So, for better or worse, in C++ we'll still have this...

if (user && user->isValid())
    user->isValid()->logUserIn();
Enter fullscreen mode Exit fullscreen mode