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

Username
  

Password
  





  Initialize a tag?
Posted by: gs - 21-03-2007, 04:16 PM - Forum: General Questions - No Replies

1998 Rule 29 states, \"[i]t would be incorrect to initialize the tag with an initializer which did not match the structure declared for that tag.\"

What does it mean to \"initialize the tag\"?

Print this item

  Rule 45 and polymorphism
Posted by: jlb - 07-03-2007, 03:10 PM - Forum: 6.11 Pointer Type Conversions - Replies (3)

Hello,

I am new to MISRA-C rules and in the code I am working on, there this kind of constructs :

Code:
struct TPL_ACTION {
    tpl_action_func action;    /**<  action function pointer   */
};

typedef struct TPL_ACTION tpl_action;

and for instance :

Code:
struct TPL_TASK_ACTIVATION_ACTION {
    /*  base action           */
    tpl_action    b_desc;
    /*  task descriptor pointer     */
    tpl_task      *task;
};

typedef struct TPL_TASK_ACTIVATION_ACTION
tpl_task_activation_action ;

tpl_action is an abstract type (no instance) and tpl_task_activation_action is a concrete type.

The function pointed by action function pointer takes a tpl_action * and casts it to the appropriate concrete type.

I understand rule 45 disallows pointer type casting to avoid memory alignment problems but here the first member of the abstract type is of the same type as the first member of the concrete type.

Is it legal ?

Best regards

Print this item

  Casting a Float to a Signed Integer
Posted by: embedded.kyle - 05-03-2007, 10:04 PM - Forum: 6.10 Arithmetic Type Conversions - Replies (1)

I'm working with some legacy code and part of my job is to modify it to comply with the MISRA standard. A large portion of the code relies on macros such as this one:

[code]#define CURRENT_LARGE_SHIFT (18L)
#define CURRENT_LARGE_SCALE(v) (int32_t)(v * (1L

Print this item

  Other question about pointer to void
Posted by: fwamolina - 07-02-2007, 08:48 PM - Forum: 6.11 Pointer Type Conversions - Replies (1)

In misraC-2004 when starts section 6.11 - Pointer type Conversion says the following:

\"Conversions involving pointer types require an explicit cast except when:
The conversion is between a pointer to object an a pointer to void....\"

my question is if this example is compliance with that.

Code:
void func (void)
{
  void*          pt_V;
  uint8_t*       pt_A;
  uint32_t*      pt_B;

  .
  .
  .

  pt_V = pt_A;

  /* use pointer */

  pt_V = pt_B;

  /* use pointer */

  .
  .
  .
}

thank you.

Print this item

  Boolean Types
Posted by: djtachyon - 05-02-2007, 07:08 PM - Forum: 6.6 Types - Replies (1)

Just wondering what is the best way to define a boolean type for MISRA and most importantly what to define TRUE and FALSE as.

Some thoughts:

typedef unsigned char boolean_t
#define TRUE (0==0)
#define FALSE (!0)

Thanks.

Print this item

  MISRA C 2004 Compliance Matrix
Posted by: Anonymous - 11-01-2007, 09:32 AM - Forum: General Questions - Replies (1)

Is there a template of the required Compliance Matrix available?

I would like to see such a matrix include the rule synopsis as well as it's ID, so that it is easy to comprehend.

Having purchased the MISRA-C 2004 PDF, I find that it is protected such that I cannot copy the contents of Appendix A as a good starting point.

Regards
Dave Banham

Print this item

  Void Pointer Usage
Posted by: MikeS - 11-01-2007, 09:04 AM - Forum: 6.11 Pointer Type Conversions - Replies (1)

Hi,

I have a question regarding the use of Void pointers.

Rule 11.2 is the rule that applies (Conversions shall not be performed between a pointer to object and any type other than an integral type, another pointer to object or a pointer to void).

My first question is:
How do you define \"a pointer to object\"?
By this, do you mean structure, derived types?
I couldn't see any definition for this in the MISRA text.

My second question is:
This rule allows the conversion of a pointer from one type to void. (i.e. to a NULL_PTR to allow for error checking)
I think that this rule also prohibits the use of a defined void ptr, converting this to point to an array or other obect, is this correct?

i.e. the following is illegal:

void *pv_my_void_ptr = NULL_PTR;
u16 *pu16_my_int_ptr = (u16 *)pv_my_void_ptr;

As this would make the checking of alignment (i.e. Rule 11.4) impossible as well as hiding the original type pointed to?

Many Thanks for your consideration.

Mike.

Print this item

  Complementary documentation on MISRA Rules
Posted by: Nicolette MAZURIER - 11-12-2006, 11:07 AM - Forum: General Questions - No Replies

I am working as a Software Quality Engineer at Siemens VDO in France and we are currently trying to document the consequence(s) of not respecting each of the MISRA rules, in order to make our developers aware of the risk(s). Sometimes this task is quite easy and sometimes less. So I am looking for some documentation that could help us reaching our objective. Today we are still using MISRA 1998, so I am more interested in documents dealing with the correponding rules, but it would also help for the future if some documents on MISRA 2004 exist.

Thanks for Help,

NM

Print this item

  MISRA Autocode Public Review
Posted by: david ward - 08-12-2006, 12:17 PM - Forum: Announcements - No Replies

MISRA has been developing a set of guidelines for users of control system modelling packages. The aim of the guidelines is to provide a set of rules, in a similar fashion to the MISRA C rules, which encourage good modelling practices and avoid poorly-defined features of the modelling language. In light of automotive industry trends, some rules will be aimed at the use of automatic code generators in safety-related systems.

Following the initial activities of this Working Group, MISRA is pleased to announce that drafts of the first documents will be available in the new year for public comment. These documents are:

  • MISRA SLSF - guidelines for users of Simulink and Stateflow
  • MISRA TL - guidelines for users of Targetlink
  • MISRA ACG - guidelines for compliance with MISRA C in automatically-generated code
If you are prepared to receive one or more of these documents for review, please visit the MISRA website to download a reply form and return by post or fax to MIRA. As this form requires a signature to indicate acceptance of the terms, only fully completed and signed copies can be accepted.

Print this item

  MISRAC Rules
Posted by: prabhakarp - 21-11-2006, 10:51 AM - Forum: MISRA-C:1998 to MISRA-C:2004 migration - No Replies

hello all,

can you anyone provide me some documents related to MISRA C rules

thanks

Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,172
» Latest member: jeongsang kim
» Forum threads: 998
» Forum posts: 2,752

Full Statistics

Online Users
There are currently 301 online users.
» 0 Member(s) | 299 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: 38
Rule 0.1.2
Forum: 4.0 Language independent issues
Last Post: stephanmuench
21-11-2024, 01:12 PM
» Replies: 0
» Views: 48
A18-9-4
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
23-10-2024, 12:04 PM
» Replies: 2
» Views: 400
A8-4-5: are partial moves...
Forum: AUTOSAR C++:2014 rules
Last Post: misra cpp
22-10-2024, 02:03 PM
» Replies: 1
» Views: 339
model information blocks ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:27 PM
» Replies: 1
» Views: 4,460
MISRA AL SLSF - Rule 043I
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
22-10-2024, 01:11 PM
» Replies: 1
» Views: 8,876
MISRA AC EC guidelines
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:21 AM
» Replies: 4
» Views: 15,525
News on future releases
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 08:05 AM
» Replies: 1
» Views: 5,707
Signal naming convention ...
Forum: MISRA AC SLSF discussions
Last Post: misra-ac
21-10-2024, 07:57 AM
» Replies: 1
» Views: 7,259
Rule 7.0.2: operator cons...
Forum: 4.7 Standard conversions
Last Post: karos
14-10-2024, 08:52 PM
» Replies: 2
» Views: 450