Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 7.0.2: operator const char *()
#2
The later, it should be treated as non-compliant. In effect you've got an object of type C being converted to bool, even if it does go through extra steps.

if (c.operator()) ;
  or
if ( c );  // if C declared operator bool();
would both be compliant.
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Messages In This Thread
Rule 7.0.2: operator const char *() - by karos - 11-10-2024, 12:33 PM
RE: Rule 7.0.2: operator const char *() - by misra cpp - 11-10-2024, 02:41 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)