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

Username
  

Password
  





  Will Exemplar Suite be updated for 2012?
Posted by: SteveTj - 25-11-2013, 10:27 PM - Forum: MISRA-C:2004 Exemplar Suite - Replies (2)

Will the MISRA-C:2004 Exemplar Suite be updated for MISRA-C:2012?

Thanks!

SteveTj

Print this item

  0-1-8. Exception: empty interface function.
Posted by: Alex-R - 18-11-2013, 01:55 PM - Forum: 6.0 Language independent issues (C++) - Replies (4)

0-1-8:
The following are examples of external side effects:
• Reading or writing to a ile, stream, etc.;
• Changing the value of a non local variable;
• Changing the value of an argument having reference type;
• Using a volatile object;
• Raising an exception.


Situation:
There is some mouse interface: OnMouseUp, OnMouseDone, OnMouseMove... or some other manipulator interface... does not matter...
There are some objects that use this interface but not all objects need all functions, so it is possible:
void SomeObject::OnMouseMove ( uint32 x, uint32 y)
{
//do nothing
}

Print this item

  Rules 0-1-3, 0-1-4, 0-1-5 and 0-1-8. External libs.
Posted by: Alex-R - 18-11-2013, 01:17 PM - Forum: 6.0 Language independent issues (C++) - Replies (1)

Rules 0-1-3, 0-1-4, 0-1-5 and 0-1-8 could have exception as using external libs.
The could be include external lib header or involved lib external sources that have more functionality than uses the project.

Yes?

Print this item

  the definition of distinct
Posted by: Takafumi Wakita - 18-11-2013, 06:18 AM - Forum: 8.5 Identifers - Replies (1)

Hello,

in the Rule 5.1, 5.2, 5.3, 5.4 and 5.5.

When portability is not our concern:

Can we use the implementation defined limits for the definition of distinct?

Best regards,
Takafumi Wakita

Print this item

  Is it possible to right shift a signed variable? (12.7)
Posted by: jbrookley - 29-10-2013, 06:01 PM - Forum: 6.12 Expressions - Replies (2)

Hello everyone,

I have an application that I need to right shift a signed variable but it seems to be giving me some issues. My initial line was:

Code:
typedef unsigned char uchar8;
typedef signed long slong32;

slong32 Shifted Long;
uchar8 NumBitsShift;

ShiftedLong >>= NumBitsShift - 1u;

Due to various MISRA C requirements, the code has morphed into this ridiculous block:

Code:
typedef unsigned char uchar8;
typedef signed char schar8;
typedef signed long slong32;

slong32 Shifted Long;
uchar8 NumBitsShift;
uchar8 tempchar = 0;
slong32 templong = 0;

tempchar = (uchar8)(NumBitsShift - 1u);

if((tempchar>=1u)&&(tempchar> tempchar; /* MISRA C 12.7 Error here */
}

On the flagged line, I get the error "Underlying type of LHS operand bitwise operator is signed type: ShiftedLong". I've tried fixing that by casting the tempchar as shown below:

Code:
ShiftedLong = ShiftedLong >> (slong32)tempchar;

I even tried to go completely over the top with plans to scale it back once I isolate the problem by doing this:

Code:
ShiftedLong = (slong32)((slong32)ShiftedLong >> (slong32)tempchar);

It appears, I am still having the same problem. What it now appears, based on this, is that it is not possible to right shift a signed variable. Is this true or is there a way around this?

Any help you can give me would be appreciated. Thanks!

Print this item

  Circular logic with rule 12.1
Posted by: jbrookley - 28-10-2013, 10:30 PM - Forum: 6.12 Expressions - Replies (4)

Hello,

I had a violation for rule 10-5 (the result of a

Print this item

  Last example for rule #13.6?
Posted by: gs - 28-10-2013, 05:55 PM - Forum: 8.13 Side effects - Replies (1)

Try as I might, I cannot get my compiler to recognize the last example for rule #13.6, the example involving an array of function pointers, as well formed. Is this intended?

Print this item

  Does 11.4 apply to any pointer or just object pointers?
Posted by: rgamble - 25-10-2013, 04:17 PM - Forum: 8.11 Pointer type conversions - Replies (2)

The scope of Rule 11.4 is unclear. The headline text for Rule 11.4 uses the phrase "pointer to object", the amplification just uses "pointer", and the rationale uses both phrases. Is this rule intended to apply to pointers to functions and pointers to incomplete types? In other words, are the following violations of this rule?

Code:
void *vp        = 1;
int (*fp)(void) = 1;

If the answer is "yes", then does the exception for null pointer constants (which also uses the phrase "pointer to object") apply to all pointers or just pointers to objects? E.g.:

Code:
int *ip         = 0;  // Okay, allowed by exception
void *vp        = 0;  // Okay?
int (*fp)(void) = 0;  // Okay?

Print this item

  Rule 12.4 - Do not use expressions with side effects
Posted by: jbrookley - 24-10-2013, 10:17 PM - Forum: 6.12 Expressions - Replies (3)

Hello everyone,

I am having a problem with rule 12.4 (Do not use expressions with side effects in the right hand operand of a logical '&&' operator). My code is as follows:

[code]if ((DualDAC == 0) && (ADC1Flag

Print this item

  MISRA2004-12_7-3 - Underlying type of LHS operand
Posted by: jbrookley - 17-10-2013, 11:29 PM - Forum: 6.12 Expressions - Replies (6)

I'm currently using Parasoft's C++ Test program and it's flagging the last line of the code below and I'm not seeing the error . . . "The error I'm getting is Underlying type of LHS operand of bitwise operator is signed type." Below is the code:

[code]typedef signed short sshort16;

struct DACStruct
{
sshort16 Off;
};

struct DACStruct DACData;

DACData.Off = (sshort16)(EEPROM_BANK1[1]) + (((sshort16)(EEPROM_BANK1[0]))

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 314 online users.
» 0 Member(s) | 311 Guest(s)
Applebot, 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: 380
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,506
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,248
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 437