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

Username
  

Password
  





  Rule 15.5
Posted by: Mandar_Pitale - 13-08-2014, 10:13 AM - Forum: 8.15 Control flow - Replies (3)

Rule 15.5 is "A function should have a single point of exit at the end".

The Rationale of this rule says:

Early returns may lead to the unintentional omission of function termination code.

1. What is "function termination code" in this context? Does it mean user defined C statements of the function or the function epilogue after the compilation?

2. If it is the function epilogue, then does it mean that when multiple exit points are used, then it MAY result in imbalanced context retrieval when the function returns, for some compilers?

Print this item

  Resolve Rule 5-0-6: cast to 7 bits struct field
Posted by: pvarela - 12-08-2014, 03:44 PM - Forum: 6.4 Standard conversions (C++) - Replies (1)

How can resolve next Notes??

Note 1960: Violates MISRA C++ 2008 Required Rule 5-0-6, Implicit conversion of integer to smaller type
Note 1960: Violates MISRA C++ 2008 Required Rule 5-0-3, Implicit conversion of integer cvalue expression


In this assignament:
CTU.EVTCFGR[fTriggerChannel].B.CHANNEL_VALUE = static_cast (fAdcChannel & 0xFFU);

Where CHANNEL_VALUE is:
union { /* Event Config 0..63 (Base+0x0030-0x012C) */
vuint32_t R;
struct {
vuint32_t :16;
vuint32_t TM:1;
vuint32_t CLR_FLAG:1;
vuint32_t :5;
vuint32_t ADC_SEL:1;
vuint32_t :1;
vuint32_t CHANNEL_VALUE:7;
} B;
} EVTCFGR[64];


Thanks in advance

Print this item

  ISO 26262 trace guideline
Posted by: softwaresafetyllc - 12-08-2014, 03:58 AM - Forum: MISRA SA discussions - Replies (1)

I read on the MISRA web site the description of MISRA C2012 that there was also a ISO 26262 compliance guideline/cross reference.
I cannot find that guideline either as free or paid posting. What are the search terms I should use?

Kind regards,
Richard Vance
Software Safety LLC
USA/Mexico

Print this item

  Typecasting from signed to unsigned and vis-verse
Posted by: deepabagalkot - 31-07-2014, 10:47 AM - Forum: 6.10 Arithmetic Type Conversions - Replies (1)

Hi,

Please can anybody help me to understand whether Misra C rules support signed to unsigned and vis-verse data typecasting?

If there is requirement to do some manipulation on signed and unsigned values, then i think it is ok to type-caste. But the requirement given to us says that whenever there is typecasting happening from signed to unsigned and vis-verse, then such incident should be failed.

Thanks in advance,
Deepa

Print this item

  Typecasting from signed to unsigned and vis-verse
Posted by: deepabagalkot - 31-07-2014, 10:37 AM - Forum: 8.11 Pointer type conversions - Replies (1)

Hi,

Please can anybody help me to understand whether Misra C rules support signed to unsigned and vis-verse data typecasting?

Thanks in advance,
Deepa

Print this item

  Rule 5.1: typographical error?
Posted by: swestin - 30-07-2014, 02:15 PM - Forum: 8.5 Identifers - Replies (1)

The amplification for this rule states:

Quote:In C99 the minimum requirement is that the first 31 characters of external identifiers are significant, with each universal character or corresponding extended source character occupying between 6 and 10 characters.

I think this is an error, and the statement should end as the parallel statement for Rule 5.2:

Quote:In C99 the minimum requirement is that the first 31 characters of external identifiers are significant, with each universal character or corresponding extended source character counting as a single character.

Is this correct?

-Stephen H. Westin
GrammaTech, Inc.

Print this item

  is File Include Guard applicable/reviewed with Rule 19.4 ?
Posted by: edgartorres0523 - 18-07-2014, 06:17 PM - Forum: 6.19 Preprocessing Directives - Replies (1)

Hi team,
First of all, I want to thank you for supporting people with this amazing forum that is very useful , "Thumbs up".

I have the following File Include Guard:
#ifndef _MYHEADER_H_ // beginning
#define _MYHEADER_H_
...
#endif // end

My question is if File Include Guards have to be applicable/reviewed with the MISRA-C:2004 Rule 19.4 ?

Thanks and Best Regards.
edgartorres0523

Print this item

  Rule 2.4 and tags the same as typedef names
Posted by: nduru - 18-07-2014, 03:53 PM - Forum: 8.2 Unused code - Replies (1)

Rule 2.4 states that a project should have no unused tag declarations. However in Rule 5.7, a tag name shall be a unique identifier, there is an exception that allows the tag to be the same as the typedef name. You give this example:
typedef struct coord
{
uint16_t x;
uint16_t y;
} coord; /* Compliant by exception */

Can this also be an exception to 2.4 ?

Print this item

  What about unused variables?
Posted by: swestin - 18-07-2014, 01:51 PM - Forum: 8.2 Unused code - Replies (2)

The guidelines proscribe declaring unused types, tags on structures or enums, macros, or labels.

Shouldn't there be a prohibition of undeclared variables, too?

-Stephen H. Westin

Print this item

  Rule 18.4 using -- operator for pointers
Posted by: simondl - 17-07-2014, 06:28 AM - Forum: 8.18 Pointers and arrays - Replies (1)

Dear

Rule 18.4 mentions +, -, += and -= operators and also ++ operator (both post and pre fix?). -- operator is not mentioned. How to deal with it?

Regards

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 361 online users.
» 0 Member(s) | 359 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: 373
A8-4-5: are partial moves...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
22-10-2024, 02:03 PM
» Replies: 1
» Views: 326
model information blocks ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:27 PM
» Replies: 1
» Views: 4,444
MISRA AL SLSF - Rule 043I
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:11 PM
» Replies: 1
» Views: 8,862
MISRA AC EC guidelines
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:21 AM
» Replies: 4
» Views: 15,502
News on future releases
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:05 AM
» Replies: 1
» Views: 5,693
Signal naming convention ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 07:57 AM
» Replies: 1
» Views: 7,246
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 431