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

Username
  

Password
  





  Essential Type of parenthesised expression
Posted by: misra-c - 11-04-2014, 07:47 AM - Forum: 8.10 The essential type model - Replies (1)

What is the essential type of a parenthesised expression?

For example: ( 3 U ) has a standard type of "unsigned int". Is the essential type of the parenthesised expression "unsigned int" or "unsigned char"

Print this item

  MISRA C:2012 addenum typo
Posted by: Lundin - 04-04-2014, 02:10 PM - Forum: MISRA C:2004 to MISRA C:2012 migration - Replies (1)

I found a typo in the MISRA C:2012 addenum.

Page 6, rule 2004:19.4 compared with 2012:20.4

Quote:Rule 14.6 requires that a macro with more than 1
statement does not get expanded in an iteration or
selection statements.

Rule 14.6 does not exist. It should be Rule 15.6 "The body of an iteration statement..." /--/ "...should be a compound statement".

Print this item

  Questions about Rule 2.1
Posted by: tsukukazu - 01-04-2014, 09:42 AM - Forum: 8.2 Unused code - Replies (4)

In rule 2.1 sample code,

default:
{
/*
* This default will only be ......
* holds a value that is not ......
*/
}

The comments here,there are not written neither compliant nor non-compliant.
But I have understood to be compliant from the comment.
Is it correct?

Best Regards.

Print this item

  A Question for Rule8.5
Posted by: KumikoItoh - 01-04-2014, 01:12 AM - Forum: 8.8 Declarations and defnitions - Replies (1)

Hello

I have a question for the Rule8.5 etc.

The Rule8.5 in MISRAC_2004 was deleted in MISRAC_2012.

In MISRA C:2012 RuleMappings,
Rule8.5's description is
[The problems associated with --- dealt with by other rules].

I think that "other rules" means "Rule8.4, Rule8.5, and Rule8.6 in MISRAC 2012".

Is my opinion correct?

Please teach me your idea and rule numbers.

Best Regards,
Kumiko Itoh

Print this item

  I comply with which rules
Posted by: bschoi1984 - 27-03-2014, 01:09 PM - Forum: General Questions - Replies (2)

I have mixed feeling for comply with MISRA-C 2004 because I use Autocode generator such as TargetLink and I think it is reasonable that they make efforts to comply with MISRA-AC such as MISRA-AC ACG, MISRA-AC TL and MISRA-AC SLSF.

So I don’t know which stand (MISRA-C or MISRA-AC) I have to conform to.
I want to know which standard the people using hand-coding comply with and the people using MBD(Model-based development with AutoCode Generator) comply with.
If possible, please give me some opinions

Print this item

  Rule 11.3 Access to registers or memory
Posted by: barbara.seyfarth - 27-03-2014, 10:31 AM - Forum: 6.11 Pointer Type Conversions - Replies (2)

A cast should not be performed between a pointer type and an integral type, this casts from type "unsigned int" to "uint32_t volatile *" (MISRA C 2004 rule 11.3)
In two cases this error occurs on my system (ARM Cortex M3 with IAR workbench and MISRA check from IAR):
1. Access to registers.
2. Access to RAM (during a cyclic RAM test).

Is there any way conform to MISRA C2004 for the following code?

Code:
register uint32_t address; /* during the critical section no RAM access other than the test access may occur */
    register uint32_t pattern;

    ...
    *(volatile uint32_t *)address = pattern;

Print this item

  Out of date link
Posted by: keith.collyer - 20-03-2014, 03:18 PM - Forum: General Questions - Replies (1)

Who needs to be contacted about an inaccurate link on the Links page of the web site (http://www.misra.org.uk/Links/tabid/63/Default.aspx)? Telelogic was acquired by IBM in 2008, so this entry should now read "IBM Rational" and the link should be http://www-01.ibm.com/software/rational/.

Thanks

Print this item

  MISRA rule 20.1 and 20.2
Posted by: VRK - 14-03-2014, 06:53 PM - Forum: 6.20 Standard Libraries - Replies (2)

20.1 (req): %s: Reserved identifiers, macros and functions in the standard library, shall not be defined, redefined or undefined.
20.2 (req): %s: The names of standard library macros, objects and functions shall not be reused.

As per the rule 20.1, Reserved identifiers should not be defined, redefined or undefined.
I am getting the violation of MISRA 20.2 for the below example:

For the declaration,
int for;
'for' is the reserve identifier. It is re-defined as variable declaration and it is not used in any standard library.
Hence it should violates the MISRA rule 20.1 and not MISRA rule 20.2.

Please explain the difference between MISRA 20.1 and 20.2 rules with suitable examples.

Print this item

  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

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,309
» Latest member: 1fuhd
» Forum threads: 1,066
» Forum posts: 2,933

Full Statistics

Online Users
There are currently 82 online users.
» 0 Member(s) | 78 Guest(s)
Bing, Facebook, Google, UptimeRobot

Latest Threads
13.2 Was TC2 correctly ap...
Forum: 8.13 Side effects
Last Post: misra-c
08-10-2026, 12:47 PM
» Replies: 1
» Views: 625
20.12 Does the stringific...
Forum: 8.20 Preprocessing directives
Last Post: misra-c
08-10-2026, 12:40 PM
» Replies: 1
» Views: 554
13.3 Should side effects ...
Forum: 8.13 Side effects
Last Post: misra-c
08-10-2026, 12:37 PM
» Replies: 1
» Views: 428
11.6 pointer to pointer t...
Forum: 8.11 Pointer type conversions
Last Post: misra-c
08-10-2026, 12:21 PM
» Replies: 2
» Views: 1,032
What is the UTLR of -1?
Forum: 8.10 The essential type model
Last Post: misra-c
08-10-2026, 12:15 PM
» Replies: 1
» Views: 598
10.3 Clarify if narrower ...
Forum: 8.10 The essential type model
Last Post: misra-c
08-10-2026, 11:57 AM
» Replies: 1
» Views: 508
It 8.12 intended to be so...
Forum: 8.8 Declarations and defnitions
Last Post: misra-c
08-10-2026, 11:50 AM
» Replies: 1
» Views: 455
Rule 0.1.1 Example f4
Forum: 4.0 Language independent issues
Last Post: cgpzs
07-10-2026, 11:07 AM
» Replies: 3
» Views: 728
Rule 6-2-2 Usage of std::...
Forum: 6.6 Statements (C++)
Last Post: misra cpp
25-09-2026, 05:43 PM
» Replies: 1
» Views: 437
M5-0-4 switch over unscop...
Forum: 6.5 Expressions (C++)
Last Post: misra cpp
25-09-2026, 01:00 PM
» Replies: 3
» Views: 539