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

Username
  

Password
  





  6.2 and switch/case labels
Posted by: dreser - 11-03-2014, 04:44 PM - Forum: 6.6 Types - Replies (1)

I'm not 100% sure on the interpretation of rule 6.2 when it comes to using "unsigned char" values as labels for switch case.

Example:

Code:
const uint8_t CONSTANT_ONE = 12U;
const uint8_t CONSTANT_TWO = 34U;

uint8_t value = foo();

switch (value)
{
case CONSTANT_ONE:
  [...]
   break;
case CONSTANT_TWO:
  [...]
   break;
default:
  [...]
   break;
}

For each of the "case " lines PC-lint (from V9.00j on) complains about a "Disallowed use of non-numeric value in a case label".
I would have considered defining and using the contants as "storage and use of numeric values" as described in 6.2.
I also can not find a similar limitation in MISRA-C 2012. Though I might not have looked deeply enough as I only have it in printed form.

Thanks for any feedback you might have on this.

Print this item

  MISRA C:2012 Examples Suite now available
Posted by: david ward - 11-03-2014, 12:07 PM - Forum: Announcements - No Replies

MISRA is pleased to announce that a set of code examples for MISRA C:2012 is available to download. These can be found in the “Resources” section of this Bulletin Board (free registration is required to access this area).

This set of files is intended to illustrate issues addressed by the MISRA C rules as expressed in MISRA C:2012 Guidelines for the use of the C language in critical systems. The code examples are mainly taken from the example sections in the MISRA C:2012 guidelines. It is not intended to be an exhaustive test suite and should not be used as such; however they may help users of the document understand compliant and non-compliant code.

A more comprehensive exemplar suite may be produced in the future.

Print this item

  Status of MISRA AC documents March 2014
Posted by: david ward - 11-03-2014, 12:04 PM - Forum: MISRA AC AGC discussions - Replies (3)

The MISRA Autocode (AC) suite of documents will be undergoing a refresh in the near future to bring them up to date and align them with the new MISRA branding and other MISRA documents. MISRA AC GMG and MISRA AC SLSF will be reviewed and updated.

Based on the experience of MISRA AC contributors in using the current documents, the number and organization of documents is also up for consideration. In particular, it is believed that the code generation specific layer of guideline documents, where MISRA AC TL sits and where a MISRA AC EC offering could sit, is better supported by tool vendors themselves; the frequency of updates to auto-code generation tools has proved too high for a user-based body such as MISRA to keep track of, and it is in the interest of the tool vendors to provide guidelines directly to support their customers in meeting their respective industry software development standards.

MISRA AC TL is now seven years old and far removed from the current version of the tool offered by its vendor. This document will be deprecated and no longer supported by MISRA from 1 June 2014.

MISRA AC AGC will remain available and supported for legacy users of MISRA C:2004. It should be noted that the current version MISRA C:2012 integrates requirement for automatically-generated C code.

Print this item

  Status of MISRA AC documents March 2014
Posted by: david ward - 11-03-2014, 12:04 PM - Forum: MISRA AC TL discussions - Replies (1)

The MISRA Autocode (AC) suite of documents will be undergoing a refresh in the near future to bring them up to date and align them with the new MISRA branding and other MISRA documents. MISRA AC GMG and MISRA AC SLSF will be reviewed and updated.

Based on the experience of MISRA AC contributors in using the current documents, the number and organization of documents is also up for consideration. In particular, it is believed that the code generation specific layer of guideline documents, where MISRA AC TL sits and where a MISRA AC EC offering could sit, is better supported by tool vendors themselves; the frequency of updates to auto-code generation tools has proved too high for a user-based body such as MISRA to keep track of, and it is in the interest of the tool vendors to provide guidelines directly to support their customers in meeting their respective industry software development standards.

MISRA AC TL is now seven years old and far removed from the current version of the tool offered by its vendor. This document will be deprecated and no longer supported by MISRA from 1 June 2014.

MISRA AC AGC will remain available and supported for legacy users of MISRA C:2004. It should be noted that the current version MISRA C:2012 integrates requirement for automatically-generated C code.

Print this item

  Status of MISRA AC documents March 2014
Posted by: david ward - 11-03-2014, 12:03 PM - Forum: MISRA AC SLSF discussions - Replies (1)

The MISRA Autocode (AC) suite of documents will be undergoing a refresh in the near future to bring them up to date and align them with the new MISRA branding and other MISRA documents. MISRA AC GMG and MISRA AC SLSF will be reviewed and updated.

Based on the experience of MISRA AC contributors in using the current documents, the number and organization of documents is also up for consideration. In particular, it is believed that the code generation specific layer of guideline documents, where MISRA AC TL sits and where a MISRA AC EC offering could sit, is better supported by tool vendors themselves; the frequency of updates to auto-code generation tools has proved too high for a user-based body such as MISRA to keep track of, and it is in the interest of the tool vendors to provide guidelines directly to support their customers in meeting their respective industry software development standards.

MISRA AC TL is now seven years old and far removed from the current version of the tool offered by its vendor. This document will be deprecated and no longer supported by MISRA from 1 June 2014.

MISRA AC AGC will remain available and supported for legacy users of MISRA C:2004. It should be noted that the current version MISRA C:2012 integrates requirement for automatically-generated C code.

Print this item

  Status of MISRA AC documents March 2014
Posted by: david ward - 11-03-2014, 12:03 PM - Forum: MISRA AC GMG discussions - No Replies

The MISRA Autocode (AC) suite of documents will be undergoing a refresh in the near future to bring them up to date and align them with the new MISRA branding and other MISRA documents. MISRA AC GMG and MISRA AC SLSF will be reviewed and updated.

Based on the experience of MISRA AC contributors in using the current documents, the number and organization of documents is also up for consideration. In particular, it is believed that the code generation specific layer of guideline documents, where MISRA AC TL sits and where a MISRA AC EC offering could sit, is better supported by tool vendors themselves; the frequency of updates to auto-code generation tools has proved too high for a user-based body such as MISRA to keep track of, and it is in the interest of the tool vendors to provide guidelines directly to support their customers in meeting their respective industry software development standards.

MISRA AC TL is now seven years old and far removed from the current version of the tool offered by its vendor. This document will be deprecated and no longer supported by MISRA from 1 June 2014.

MISRA AC AGC will remain available and supported for legacy users of MISRA C:2004. It should be noted that the current version MISRA C:2012 integrates requirement for automatically-generated C code.

Print this item

  0-1-2 Infeasible paths clarification
Posted by: melinda.bradury - 06-03-2014, 10:56 AM - Forum: 6.0 Language independent issues (C++) - Replies (1)

I have a pure virtual function like
virtual void OnEvent(EventName event, State& superState) = 0;

For some of the derived classes, the implementation uses both of the the parameters. For others, the parameters are not used at all.

Is this acceptable?

Print this item

  Rule 7-3-6 Clarification
Posted by: melinda.bradury - 27-02-2014, 02:31 PM - Forum: 6.7 Declarations (C++) - Replies (1)

Does this rule prevent "using namespace ..." in a header file, if, it is inside a namespace?

e.g. is it ok to do this in the header...
namespace ComponentX
{
using namespace BasicTypes;
class AClass
{
public:
bool_t IsActive(void);
};
}
}

or would i have to do this...
BasicTypes::bool_t IsActive(void);

Print this item

  A question for Rule8.13
Posted by: KumikoItoh - 25-02-2014, 05:53 AM - Forum: 8.8 Declarations and defnitions - Replies (1)

I have a question for the Rule8.13.

The rule8.13 is
A pointer should point to a const-qualified type whenever possible

A pointer parameter in a function prototype should be declared as pointer to const if the pointer is not used to modify the addressed object


However,
target of the rule16.7 on MISRAC-2004 is "pointer parameter in a fuction".

Why do you delete "pointer parameter in a function"?

Please tell me the reason.


Best Regards,
Kumiko Itoh

Print this item

  A Question for a example of Rule8.6
Posted by: KumikoItoh - 25-02-2014, 05:50 AM - Forum: 8.8 Declarations and defnitions - Replies (1)

I have a question for the Rule8.6 exmaple.

Your guideline has a following example.
/* file3.c */
int16_t j; /* Tentative definition */
int16_t j=1; /* Compliant - external definition */

I make the next exapmle.
Is it correct?

/* file3_2.c */
int16_t m=1; /* Compliant - external definition */ ←is it correct?
int16_t m; /* declaration */ ←is it correct?


Best Regards,
Kumiko Itoh

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 319 online users.
» 0 Member(s) | 317 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: 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