On 18/04/2019 19:52, Stefano Stabellini wrote:
On Thu, 18 Apr 2019, Julien Grall wrote:
On 18/04/2019 19:23, Stefano Stabellini wrote:
On Wed, 17 Apr 2019, Julien Grall wrote:
On 4/17/19 9:28 PM, Stefano Stabellini wrote:
On Wed, 27 Mar 2019, Julien Grall wrote:
If it is considered compliant, then it does not make sense.

Yes, I think this is not compliant too. Also, from what I have been
told, this example is famous for being one of the most extreme examples
of MISRA-C non-compliance. I think the compliant version would be:

bool is_nonzero(int b)
{
     if (b != 0)
       return true;
     else
       return false;
}

This is also compliant:

bool is_nonzero(int b)
{
     return (b != 0);
}


I will use !!b here and in the next patch. But I still doubt you will be able to enforce it in Xen. if ( n ) is quite a common pattern.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to