== Why is this an issue?

include::../description.adoc[]

=== Noncompliant code example

[source,cpp]
----
int function1()
{
  return 3;
}

void function2()
{
  function1();
}

int function3(char* ptr) /* Noncompliant; two explicit returns */
{
  if (ptr == NULL) return -1;

  return 7;
}

void function4(char *ptr) /* Noncompliant; two returns, one explicit and one implicit */
{
  if (1) return;

  printf("hello world!\n");
}
----


== Resources

* MISRA C:2004, 14.7 - A function shall have a single point of exit at the end of the function.
* MISRA {cpp}:2008, 6-6-5 - A function shall have a single point of exit at the end of the function
* MISRA C:2012, 15.5 - A function should have a single point of exit at the end

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
