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

Username
  

Password
  





  For Loop: must update expression use only invariants?
Posted by: swestin - 29-11-2017, 03:47 PM - Forum: 6.6 Statements (C++) - Replies (1)

MISRA C:2012 Rule 14.2 puts the following restriction on the "third clause" (called "expression" in C++:2008):

Shall not use objects that are modified in the for loop body.

For example, the following violates this rule:
[code]
for (int i=0; i

Print this item

  How to add a MISRA supporting product to Useful links page
Posted by: fasoo - 22-11-2017, 12:37 AM - Forum: General Questions - Replies (1)

I have a question on adding a MISRA C and MISRA C++ supporting tool to the "Useful Links" page on https://www.misra.org.uk/Links/tabid/63/Default.aspx

Please guide me how I can request addition to the page.

Thank you and have a splendid day.

Best

Ray

Print this item

  Rule 20.8 and #elif
Posted by: rgamble - 01-11-2017, 04:03 PM - Forum: 8.20 Preprocessing directives - Replies (1)

It is pretty clear from the Amplification that this is not a violation of Rule 20.8:

Code:
#if 0
  #if 10  /* not evaluated, not a violation */
  #endif
#endif
and that this is:
Code:
#if 0
#elif 20  /* evaluated, violation */
#endif
but is the following intended to be a violation of this rule?:
Code:
#if 1
#elif 20  /* ??? */
#endif
It is not clear if the preprocessing directive #elif 20 is evaluated for the purpose of this rule.

Print this item

  Rule 18.8 and clarification of "use" of VLA types
Posted by: rgamble - 27-10-2017, 04:23 PM - Forum: 8.18 Pointers and arrays - Replies (1)

What exactly is meant by the "use" of "variable-length array types"? The examples suggest that the mere declaration of an object of variable length array type violates this rule which makes sense if the declaration is thought of as "using" the VLA type.

The example below declares a pointer to a VLA type and then dereferences the pointer:

Code:
typedef unsigned uint32_t;
typedef int int32_t;

void foo(uint32_t sz, int32_t (*ary)[sz], int32_t val) {
    (*ary)[0] = val;
}

Is the declaration of the pointer parameter ary a violation of this rule? Is the statement that dereferences ary a violation of this rule?

Print this item

  Is MISRA C:2004 Permits applicable for MISRA C :2012 also
Posted by: Jayaram - 24-10-2017, 04:07 AM - Forum: MISRA Compliance discussions - Replies (1)

Hi,
Could you please confirm whether the "MISRA C:2004 Permits " is applicable for " MISRA C :2012" also.
Thanks,
Jayaram

Print this item

  MISRA switch staement
Posted by: Hanumanthappa E - 18-10-2017, 09:20 AM - Forum: 8.16 Switch statements - Replies (2)

Hi everyone,
Can anyone give an example of MISRA-C "switch" statement pls....

Print this item

  Rule 15.7 and empty else statements without "else if"
Posted by: rgamble - 17-10-2017, 01:36 PM - Forum: 8.15 Control flow - Replies (1)

MISRA C 2012 Rule 15.7 states in the amplification that "The else statement shall contain at least either one side effect or a
comment." Does "The else statement" refers to any else statement or just the final else statement that is required
by the rule when there are one or more "else if" statements? Is the following example a violation of Rule 15.7 because the else
statement does not contain a side effect or comment or is it compliant because the else is not required by the rule?

Code:
typedef _Bool bool_t;
void foo(bool_t x);
void foo(bool_t x) {
    if (x) {
        ;
    }  
    else { }
}

Print this item

  Guidelines for NOT embedded SW?
Posted by: andream - 17-10-2017, 01:13 PM - Forum: General Questions - Replies (4)

I wonder if it has ever been specified a sort of equivalent MISRA C standard, always for safety-critical systems, but not embedded SW, rather running on host. For instance, Plant Monitoring and Air Traffic Management.

Print this item

  misra 2012
Posted by: Hanumanthappa E - 13-10-2017, 12:53 PM - Forum: General Questions - Replies (3)

Hi all,
Where and how can download MISRA 2012 guidelines? Please....

Print this item

  Dir 4.6 and usage of "fast" types in stdint.h
Posted by: michael.metivier - 12-10-2017, 08:31 PM - Forum: 7.4 Code design - Replies (1)

Directive 4.6 indicates "typedefs that indicate sign and signedness should be used in place of the basic numerical types" and suggests that, for C99-compliant systems, the types of should be used.

stdint.h also defines "fast" types which are at least of the indicated length, but may be larger if such a length could be handled more efficiently by the processor.

Is it a violation of Directive 4.6 to utilize these types? They are not "basic numerical types", but also do not necessarily adhere to a fixed length as specified by their names.

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 581 online users.
» 0 Member(s) | 579 Guest(s)
Bing, Google

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