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

Username
  

Password
  





  MISRA C:2012 not available
Posted by: SimonB - 17-02-2016, 04:27 PM - Forum: General Questions - Replies (9)

The printed version of MISRA C:2012 is shown as "This document is temporarily out of stock" in the on-line shop http://www.misra.org.uk/shop/buy_now.php. Does anybody know when it is likely to be in print again?

The printed form has the advantage that it can be shared around the office, rather than having to pay for PDF copies for everybody involved.

Print this item

  Clarity of Rule 14-6-1
Posted by: Insane Vent Storm - 17-02-2016, 01:21 PM - Forum: 6.10 Derived classes (C++) - Replies (1)

Rule 14-6-1 says 'In a class template with a dependant base, any name that may be found in that dependant base shall be referred to using a qualified-id or this->'. Does the use of the word 'template' mean that the rule applies to template classes, or does the rule apply to all inheriting classes ?

Print this item

  10.3 Clarification on assigning unsigned literal to signed
Posted by: michael.metivier - 08-02-2016, 02:54 PM - Forum: 8.10 The essential type model - Replies (3)

Quote:A non-negative integer constant expression of essentially signed type may be assigned to an object of essentially unsigned type if its value can be represented in that type.

While Rule 10.3 has this Exception for constructions similar to
Code:
uint8_t u8a = 0;    /* By exception */
there does not seem to be a similar exception for the inverse
Code:
int8_t s8a = 1u;    /* Compliant? */
Our current analysis tool flags this as an error, but this assignment seems no more dangerous than the one given by the Example. Is there a specific rationale for why this assignment should not be allowed, given the condition of the Exception
Quote:if its value can be represented in that type.
?

Print this item

  Rule 2-10-6
Posted by: Mats Fors - 26-01-2016, 09:04 AM - Forum: 6.2 Lexical conventions (C++) - Replies (1)

Shouldn't example one be compliant?

typedef struct vector {...} vector;

The two vector identifiers are both referring to the same type.

Print this item

  Rule 16-0-1 and extern "C"
Posted by: detra - 14-01-2016, 08:45 AM - Forum: 6.16 Preprocessing directives (C++) - Replies (2)

Hello,
if we want to use the same Header files for "C" and "C++" we must use the "extern C" constuct. But the "extern C" construct must be placed before the include of the Header and so our tool reports a MISRA 16-0-1 violation. Is this violation valid? And if so, is there an other solution?

Code:
#ifndef _MYHEADER_
#define _MYHEADER_

extern "C"
{
    #include "firstheader.h"                // MISRA 16-0-1 violation
}

Thank you for help,
Stefan

Print this item

  Code generators for MISRA C++
Posted by: Insane Vent Storm - 04-01-2016, 12:55 PM - Forum: C++ General - No Replies

On the general subject of MISRA compliance and auto-code, is anyone out there using a code generating tool and trying to produce MISRA C++ 2008 compliant code ?

Print this item

  Essential type of constant expressions
Posted by: roberto - 27-12-2015, 05:06 PM - Forum: 8.10 The essential type model - Replies (1)

In MISRA-C:2012, it is stated that the essential type of the constant expression ~(unsigned short)3 is the UTLR of its value (i.e., -4), but the definition of UTLR seems not to cover this case (that is, the UTLR of -4 is undefined).

Another similar example is (unsigned char)3 - (unsigned char)4.

What is the essential type of these constant expressions?

Print this item

  15.7 and side effects
Posted by: lovewar - 11-12-2015, 12:08 AM - Forum: 8.15 Control flow - Replies (2)

Would the following examples be compliant with rule #15.7?

Code:
void R_15_7 ( void ) {
   bool_t flag_1 = get_bool ( );
   bool_t flag_2 = get_bool ( );
   if ( flag_1 )  {
      action_f1 ( );
   }
   else if ( flag_2 )  {
      action_f2 ( );
   }
   else {  // here , is the "else" compliant ?
      persistent_side_effects();
  }
}

Would the following examples be compliant with rule #15.7?
Code:
void R_15_7 ( void ) {
   bool_t flag_1 = get_bool ( );
   bool_t flag_2 = get_bool ( );
   if ( flag_1 )  {
      action_f1 ( );
   }
   else if ( flag_2 )  {
      action_f2 ( );
   }
   else {  // here , is the "else" compliant ?
      side_effects();
  }
}

Would the following examples be non-compliant with rule #15.7?
Code:
void R_15_7 ( void ) {
   bool_t flag_1 = get_bool ( );
   bool_t flag_2 = get_bool ( );
   if ( flag_1 )  {
      action_f1 ( );
   }
   else if ( flag_2 )  {
      action_f2 ( );
   }
   else {  // here, is the "else" non-compliant ?
      no_side_effects();
  }
}

Print this item

  Rule 19.1 and assigment between members of a struct
Posted by: GerlindeKettl - 20-11-2015, 10:34 AM - Forum: 8.19 Overlapping storage - Replies (1)

Does this code violate rule 19.1?

Code:
struct s_tag {  
uint8 ReadPos;
uint8 WritePos; };
typedef struct s_tag s;

union u_tag {
s      Elements;
uint32 Value; };
typedef union u_tag u;

u NewState;
NewState.Elements.ReadPos  = NewState.Elements.WritePos;
My static code checker thinks it is a violation, but from my point of view I'm just assigning one member of a struct to a different member of the struct and they don't overlap in memory. That this struct is a member of a union should not matter as there is no assignment across the members of the union.

Print this item

  MISRA C 2012 rule 8.6
Posted by: mcorles5 - 18-11-2015, 02:00 PM - Forum: General Questions - Replies (1)

The rule definition is "An identifier with external linkage shall have exactly one external definition." When I look at where it says there are multiple definitions, it points to the same line.
Ie.
global variable 'CALIBRATION_MISMATCH' has multiple tentatives of definitions (C:\User\Desktop\globals.c:137, C:\Users\Desktop\globals.c:137) (Required)
U8 CALIBRATION_MISMATCH;

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 420 online users.
» 0 Member(s) | 418 Guest(s)
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: 23
Rule 0.1.2
Forum: 4.0 Language independent issues
Last Post: stephanmuench
21-11-2024, 01:12 PM
» Replies: 0
» Views: 34
A18-9-4
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
23-10-2024, 12:04 PM
» Replies: 2
» Views: 362
A8-4-5: are partial moves...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
22-10-2024, 02:03 PM
» Replies: 1
» Views: 320
model information blocks ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:27 PM
» Replies: 1
» Views: 4,440
MISRA AL SLSF - Rule 043I
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:11 PM
» Replies: 1
» Views: 8,860
MISRA AC EC guidelines
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:21 AM
» Replies: 4
» Views: 15,497
News on future releases
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:05 AM
» Replies: 1
» Views: 5,689
Signal naming convention ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 07:57 AM
» Replies: 1
» Views: 7,244
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 429