Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





  Dir 2.1 compilation errors
Posted by: ogawa.kiyoshi - 18-02-2014, 05:23 AM - Forum: 7.2 Compilation and build - Replies (1)

In Dir 2.1 , "A conforming compiler is permitted to produce an object module despite the presence of compilation errors."
I should explain this situation for the programmers, but I do not know any real compilers, producing an object module with the presence of compilation errors.
Do anyone know a compiler which can produce an object module with the presence of compilation errors?

Dr. Ogawa Kiyoshi.
@kaizen_nagoya
http://researchmap.jp/kaizen/MISRA-C/

Print this item

  Essential Type of an Expression Clarification
Posted by: gs - 14-02-2014, 07:50 PM - Forum: 8.10 The essential type model - Replies (1)

Suppose I have:

Code:
((unsigned short) 1u) + ((unsigned short) 2u);
The essential type of each constant, '1u' and '2u', is unsigned char and the casts make the essential type of each operand unsigned short. Now, if shorts are 16 bits wide and chars are 8 bits wide, what is the essential type of the expression; unsigned char because of the value, '3u', or unsigned short because of the operands?

Print this item

  Rule 4-10-2 NULL is not a c++ standard
Posted by: minhyuk - 07-02-2014, 07:34 AM - Forum: 6.4 Standard conversions (C++) - Replies (4)

In C++ Standard, There are not exist NULL(its C standard).
So, Programmer should to know about this and Use constant 0 instead of NULL macro.

Print this item

  Rule 10.1 violation with casting
Posted by: Frasew - 06-02-2014, 12:29 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (1)

Hello,

my MISRA checker generates a MISRA violation 10.1 (The signedness of an integer type is converted implicitly.(signed -> unsigned)), although a casting is done.

My C code:

1: #include
2: typedef unsigned char U8;
...
w: U8 WriteProtect = (U8) true;
....
x: if(WriteProtect == (U8) false) {
....
y: WriteProtect = (U8) true;
....
z: }

The MISRA checker identifies line x and y as a rule 10.1 violation. Why is this a rule 10.1 violation although a casting is done? Interestingly the MISRA checker identifies line w as OK. Have anybody an idea what is my fault?

Is it generally impossible in MISRA to assign a signed var to an unsigned var?

Print this item

  Rule 11.3
Posted by: schileboh - 31-01-2014, 09:47 AM - Forum: 8.11 Pointer type conversions - Replies (1)

hello guys

i've a problem. i'm not sure if the following code is compliant to the Rule 11.3:

Code:
typedef struct SomeHeaderType
{
   uint8_t type;
   uint32_t timestamp;
   uint16_t some_attribute;
}SomeHeaderType;

void foo(uint8_t *buffer_ptr)
{
   SomeHeaderType *headerPtr = (SomeHeaderType*)buffer_ptr;
   if(headerPtr->type == 3)
   {
      uint16_t attribute = headerPtr->some_attribute;
      ...
   }
   ...
}

is it allowed to cast a 8-bit buffer pointer to a struct pointer? from my point of view, this code is not compliant, but i have some code examples here that do this and the code suggests to be MISRA conform...

thanks for clarification.

Print this item

  2.4 violation?
Posted by: gs - 28-01-2014, 05:54 PM - Forum: 7.2 Compilation and build - Replies (1)

Does the following example violate rule #2.4:

Code:
typedef enum A {
    b
} A;

A c() {
    return b;
}

Print this item

  Rule 19.1 Example
Posted by: minoru.kanome - 22-01-2014, 07:33 AM - Forum: 8.19 Overlapping storage - Replies (3)

rule 19.1 example :

a = b; /* Compliant - exception 1 */

a and b are not overlapping object.
Therefore, this code is improper as the example.
Is it right?

Print this item

  Rule 15.3 Example
Posted by: ogawa.kiyoshi - 21-01-2014, 10:09 AM - Forum: 8.15 Control flow - Replies (1)

Rule 15.3 Example
void f1(int32_t a){
if ( a 0){
L2:
;
}
}
has some unreachable codes. So I think
void f1(int32_t a){
if ( a 0){
L2:
;
}
}
are enough and no unreachable codes.

Dr. Ogawa Kiyoshi
https://twitter.com/kaizen_nagoya/, http://researchmap.jp/kaizen/MISRA-C/

Print this item

  Rule 13.2 Example
Posted by: ogawa.kiyoshi - 21-01-2014, 02:32 AM - Forum: 8.13 Side effects - Replies (1)

In Rule 13.2 Example

#define COPY_ELEMENT ( index ) ( a[( index )] = b[( index )] )

The print may have a space between COPY_ELEMENT and '('.
It generate
( index ) ( a[( index )] = b[( index )] ) ( i++ );

#define COPY_ELEMENT( index ) ( a[( index )] = b[( index )] )
"no space" seem proper.

Dr. Ogawa Kiyoshi
@kaizen_nagoya, http://researchmap.jp/kaizen/MISRA-C/

Print this item

  Constant Size and Rule 12.2
Posted by: mjlinden - 20-01-2014, 02:33 PM - Forum: 8.7 Literals and constants - Replies (4)

Hi Folks,

I'm trying to come to an understanding of an issue associated with MISRA 2012 Rule 12.2 and the interpretation of constant size. Here is the situation I'm dealing with.

=====================================================================
int32_t result;

result = (1

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,171
» Latest member: stephanmuench
» Forum threads: 998
» Forum posts: 2,752

Full Statistics

Online Users
There are currently 356 online users.
» 0 Member(s) | 353 Guest(s)
Applebot, Bing, Google

Latest Threads
Rule 6.2.1: non-inline co...
Forum: 4.6 Basic concepts
Last Post: cgpzs
22-11-2024, 10:11 AM
» Replies: 0
» Views: 26
Rule 0.1.2
Forum: 4.0 Language independent issues
Last Post: stephanmuench
21-11-2024, 01:12 PM
» Replies: 0
» Views: 36
A18-9-4
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
23-10-2024, 12:04 PM
» Replies: 2
» Views: 378
A8-4-5: are partial moves...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
22-10-2024, 02:03 PM
» Replies: 1
» Views: 328
model information blocks ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:27 PM
» Replies: 1
» Views: 4,446
MISRA AL SLSF - Rule 043I
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:11 PM
» Replies: 1
» Views: 8,863
MISRA AC EC guidelines
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:21 AM
» Replies: 4
» Views: 15,504
News on future releases
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:05 AM
» Replies: 1
» Views: 5,694
Signal naming convention ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 07:57 AM
» Replies: 1
» Views: 7,247
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 432