Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 5-0-19 are references also considered a 'pointer indirection'?
#1
More concretely, is the following code a violation?

Code:
typedef void **my_t;

void f(my_t& x)
{
   x = NULL;
}
<t></t>
Reply
#2
References are not a level of indirection.

The rule is trying to limit the complexity when accessing / understanding multiple levels of pointers - a reference simply creates an alias for an object and does not add any further levels of indirection
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)