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

Username
  

Password
  





  Rule 14.3
Posted by: mshearer123 - 17-03-2010, 03:50 PM - Forum: 6.14 Control Flow - Replies (3)

Hi,
I am running into this rule whenever using in-line assemebly in my blackfin project.

i.e

asm ("ssync;");
or
asm("nop;");

generated the error in ibm logiscope
"A null statements shall only occur on a line by itself, and shall not have any other text on the same line"

I assume this comes from having the two ";" characters on the one line.
But how can i overcome this?

Matthew

Print this item

  Should #17-0-2 include any non-function identifier?
Posted by: gs - 16-03-2010, 02:11 PM - Forum: 6.17 Library introduction (C++) - Replies (1)

A discussion of a similar rule for MISRA C concluded the rule was meant to encompass any reserved identifier. While MISRA C++ has excluded functions from this rule and placed their consideration under rule #17-0-3, no mention of standard types (e.g, clock_t) or any other non-function identifier is made as far as I can tell. Should the rule include these also?

Print this item

  8.7 if applied to C++
Posted by: gs - 15-03-2010, 06:25 PM - Forum: 6.8 Declarations and Definitions - Replies (2)

Suppose one wanted to ensure one's C++ code complied with the MISRA C guidelines. Would a static data member of a struct or class be permitted to be accessed by only one function or should that static member be defined at block scope? Suppose the struct/class type were a local one? Would moving the definition of the static member out of the class and directly into block scope provide any benefit?

Print this item

  compiler library files
Posted by: mshearer123 - 12-03-2010, 10:31 AM - Forum: General Questions - Replies (2)

Hi,
I am currently working on a Blackfin project, developing in VISUAL DSP++

I would like to bring this to MISRA, however if i use "include" files such as stdio.h or ccblkfn.h do they comply with MISRA?

I have tried to bring any include files into my local workspace so that logiscope can run through them aswell, this results in hundreds of violations from the files.

Can I claim MISRA compliance with these files? or is there an alternative route i.e. buying MISRA compliant librarys?

Thanks for any advice,

Matthew

Print this item

  Rule 19.15 #include ssyntax, bad name
Posted by: mshearer123 - 02-03-2010, 03:54 PM - Forum: 6.19 Preprocessing Directives - Replies (4)

Hi,

My header files all include #ifndef / #define 's to stop them being included twice, however apparently the name is bad.

i have things like
#ifndef __DMA_h
#define __DMA_h
#endif


and

#ifndef __flash_h
#define __flash_h
#endif

Also changing to the following gives the same error

#ifndef flash_h
#define flash_h
#endif

any help would be great,

Matt

Print this item

  Rule 3.4: All uses of the #pragma directive shall be...
Posted by: mshearer123 - 02-03-2010, 11:32 AM - Forum: 6.3 Documentation - Replies (3)

Hi,
What exactly does this rule mean?
How do i document a #pragma?

thanks,

Matt

Print this item

  Rule 10.1 (DSP code)
Posted by: mshearer123 - 01-03-2010, 02:06 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (2)

Hi,

My code for running a blackfin DSP uses pointers to registers to set specific register values.

i.e.

Code:
*pSPI_FLG = 0x01;

however this generates a MISRA compliancy error.

what other way round this is there?

thanks for any help


matt

Print this item

  8.7 wording?
Posted by: gs - 25-02-2010, 07:47 PM - Forum: 6.8 Declarations and Definitions - Replies (4)

Am I correct in presuming "Objects shall be defined at block scope if they are only accessed from within a single function," should read declared instead of defined?

Print this item

  Exemplar suite for C++
Posted by: azukich - 19-02-2010, 03:20 PM - Forum: C++ General - Replies (2)

Is there an exemplar suite for C++? If not is this in the plans to create this?

Thank you

Print this item

  Booleans and the unterlying type
Posted by: gunter.blache - 15-02-2010, 10:34 AM - Forum: 6.10 Arithmetic Type Conversions - Replies (6)

There are no boolean types in C and I assume that rule 10.x also apply to boolean expressions. The question now is how to make
boolean expressions compliant to these rules.
If there are variables boolU8 and boolS8 which are of type unsigned char and signed char are represent boolean values, and assignment
will require an explicit cast:
boolU8 = (uint8)boolS8;
No problem here.

Boolean operators &&, || and ! yield a result of type "int" (MISRA-C:2004 page 37 3rd paragraph), which confuses me a little bit,
because I expected the guideline to specify an "underlying type" instead of a real type.
So to have a simple assignment like
boolU8 = c && d;
compliant, I have to downcast to the result to uint8, which requires a temporary variable (according to rule 10.3):
int _t = c && d;
boolU8 = (uint8)_t;

The is no more safe than the simple assignment, a lot less readable and involves the plain type "int", which violates rule 6.3 (typedefs
should be used in place of the basic types).

I did not find anything on this subject in the technical corrigendum, nor does the entry in the glossary on "boolean expressions" help
with type casting.

Any thoughts ?

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,209
» Latest member: asiaxing2012
» Forum threads: 1,017
» Forum posts: 2,796

Full Statistics

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

Latest Threads
Rule 7.0.5, example non-c...
Forum: 4.7 Standard conversions
Last Post: cgpzs
17-04-2025, 12:10 PM
» Replies: 0
» Views: 186
A3-3-2 Contradictory exam...
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
31-03-2025, 09:30 AM
» Replies: 2
» Views: 318
16.6.1 clarification
Forum: 4.16 Overloading
Last Post: cgpzs
31-03-2025, 09:29 AM
» Replies: 2
» Views: 299
Rule 9.3.1 - iteration st...
Forum: 4.9 Statements
Last Post: misra cpp
28-03-2025, 01:17 PM
» Replies: 1
» Views: 196
Rule 8.2.8 - why aren't a...
Forum: 4.8 Expressions
Last Post: misra cpp
28-03-2025, 01:05 PM
» Replies: 1
» Views: 217
Typo in Appendix C of MIS...
Forum: 8.10 The essential type model
Last Post: Yordan Naydenov
17-03-2025, 02:58 PM
» Replies: 0
» Views: 179
Adopted modal expressions...
Forum: General Questions
Last Post: Yordan Naydenov
17-03-2025, 09:01 AM
» Replies: 0
» Views: 286
Roadmap to c23 support
Forum: General Questions
Last Post: ACHart
28-02-2025, 03:23 PM
» Replies: 0
» Views: 221
Rule 6.2.1 weak linkage
Forum: 4.6 Basic concepts
Last Post: misra cpp
28-02-2025, 01:04 PM
» Replies: 1
» Views: 279
A8-4-5: Should have an ex...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
21-02-2025, 12:58 PM
» Replies: 3
» Views: 725