logo
Tags down

shadow

What is the wrong in the following c code ? MISRA quality warning message


By : Ahir Verma
Date : August 01 2020, 04:00 AM
To fix this issue I am getting MISRA QAC warning for the following code sample snippet. That is 'Value of control expression is not derived from an explicit logical operation.' , Your code has the following MISRA-C:2012 violations:
code :
bool fun1 (void); /* you must declare the function before using it and it must use void */

...

if(fun1())
{    
  /*statement1*/   /* Note that you can't use // comments in C90 or MISRA-C:2004 */
}    
else    
{    
  /*statement2*/
}

...

bool fun1 (void) /* must use void */
{    
  /* return is not a controlling expression, no need for compound statements.
     No need to cast, the result of && is essentially boolean.
     MISRA-C:2004 has no requirement to cast to underlying type if using booleans.
  */
  return Global_variable1 && Global_Variable2;
}


Share : facebook icon twitter icon

How to fix MISRA warning: MISRA 18.4 (C90-2012 adv.)


By : VANN1MAL
Date : March 29 2020, 07:55 AM
To fix this issue MISRA makes a difference between pointer and array types of a parameter. If you want to use array indices, your function header should look like
code :
int8u my_api(uint8_t a1[], uint8_t a2[], uint8_t a3[])

Is it possible to suppress MISRA warning in QA-C


By : Miichelle Rezende
Date : March 29 2020, 07:55 AM
like below fixes the issue I used: , You can add a comment above the line where there is a warning e.g.
code :
/* PRQA S 0434*/ 

How to resolve this MISRA c++ compliant warning


By : Amalia M Ersa
Date : March 29 2020, 07:55 AM
will help you First thing to note is that int foo(const uint8_t array[]) is equivalent to int foo(const uint8_t* array), i.e. the function takes a pointer to a const uint8_t, not an array. The pointer itself it not const, the pointee is. The signature should be:

How to resolve this MISRA warning: C++


By : Jessica King
Date : March 29 2020, 07:55 AM
To fix the issue you can do Here is the code as below: , Do what the warning says: take the address of the function:

Selecting Guidelines : MISRA 1998 or MISRA 2004 or MISRA 2012?


By : SlimJimmy
Date : March 29 2020, 07:55 AM
To fix this issue This is often a requirement from the area of application. You'll have safety standards dictating that a safe subset of the programming language is used. This requirement can come from the "SIL" standards such as industry IEC 61508, automotive IEC 26262, aerospace DO-178 and so on. In such mission critical systems, you may not have any other choice than to use MISRA-C.
But MISRA-C is also becoming industry standard for all embedded systems, no matter their nature. The reason why is obvious: nobody, no matter area of application, likes bad, low-quality software full of bugs.
Related Posts Related Posts :
  • Unexpected result when trying to continuously prompt until they give an integer-only input
  • function-like macros and variables
  • Using makefile file as prerequisite in a rule
  • Questions about Structure definitions
  • How many processes are created
  • strcmp usage to terminate file writing doesn't work
  • waitpid does not give me consistent results
  • Lex and Yacc symbol table generation and manipulation
  • Including all the library statically instead of parts of the library upon linking/compilation
  • Is it possible to create an array of generic function pointers?
  • Does lseek()'s SEEK_HOLE behaves as expected?
  • Why does using struct work but typedef struct not?
  • How the the output will be printed?
  • Getting pointer issue in C program
  • c function that changes permission of file
  • Why does isalpha() counter program gives wrong output? C
  • Find two worst values and delete in sum
  • Equivalent of __LINE__ macro relative to beginning of function
  • Unexpected Outcome in Playfair Cipher Program
  • Integer division which results in less than 1
  • Why does this expression come out to 4 in C?
  • C Access element of Enum without declaring variable
  • How to implement TAS ("test and set")?
  • Ethernet CRC computation
  • Can someone explain to me why my factorial recursion code can't be compiled
  • Make same #define in every file
  • String to ASCII Hex splitting in C
  • Non-negative integer?
  • Issues with regular expression rejecting string
  • C program incrementing variable with for loop
  • How to prevent LD_PRELOAD on a binary?
  • Why printf doesn't print directly a variable in C?
  • What does it mean that condition?
  • What is the difference between int (*cmp)(void) and int *cmp(void)?
  • Problem with finding mistake in program with using valgrind
  • Creating C functions with arguments but no returns, what went wrong?
  • What does 0600 mean in a function? Is it same as \200?
  • Function of retval in pthread_join
  • I am getting a warning saying I have reached end of non-void function
  • Why does GCC only complain about an unsigned int argument being used with %i when -pedantic is given?
  • How random function really works in C?
  • Linux: warning implicit declaration of function of system call
  • Good STL-like library for C
  • Why am I getting a double free or corruption error with realloc()?
  • GTK implementation of MessageBox
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org