Post Page Advertisement [Top]

Below are some of the C rules mandated by AUTOSAR


There should not be more than one declaration per line.

 Eg uint8 blockIndex, lastBlock; /*violation*/


Brackets shall always be used in complex expressions even if the C priority rules do not necessarily demand this for operators. This also applies to expressions evaluated by the pre-processor

Eg. if ( (counter1 > 0) || (counter2 < 0) )


Function comments shall be positioned in front of the function header. The function comments shall be above the functions in the C file. The function comments may also be in the H file.


/* Function name: MyFunc( uint8 X)
/* Description: Short Description, including preconditions
/* Parameter X : Description
/* Return value: None
/* Remarks: global variables used, side effects
/***********************************************************/ Void MyFunc( uint8 X)

Protection against multiple inclusion

Each header file shall protect itself against multiple inclusion.

#ifndef FILENAME_H #define FILENAME_H
#endif /* FILENAME_H */

Commenting violations:

Violations of MISRA rules shall be commented and reasoned at the corresponding code line.

Violations of AUTOSAR C programming guidelines shall be commented and reasoned at the corresponding code line.

Header includes

Header files which are a part of predefined program libraries shall be included using

Header files which are a part of the source code generated in the software project shall be included with "".

#include ;

#include "Eep.h";

Inclusion of own header file

Each module shall include its own header file.

Multiple assignments

Multiple assignments shall not be done.
x = y = z; /* violation */

Explicit definition of types

Each self-defined type has to have an explicit type declaration even if there is only one variable of this type.

typedef struct
uint16 Position; uint8 Direction;
} MotorType;

static MotorType MotorData;

to be continued..


  1. Great explanation yet again Sir. Very useful for all of us. Excellent.

  2. In spite of the fact that as a distributing legal advisor and amusement lawyer and dissimilar to some others, I will in general utilize the expression "electronic right" or even "computerized right" in the particular number, there most likely will in general be no single agreement with respect to what establishes and on the whole contains the solitary "electronic right" or "advanced right". high voltage resistor manufacturer

  3. All distributing legal advisors, amusement lawyers, creators, and others should be exceptionally cautious about the utilization of language - distributing industry language, or something else. Electronic and advanced distributing is a new wonder. diode

  4. Adjusted market rules are an essential component in Texas rivalry. Clear, unsurprising and all around planned standards help encourage a steady electricity market. China mosfet manufacturer


Bottom Ad [Post Page]