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

Username
  

Password
  





  14.1 There shall be no unreachable code
Posted by: Frank Haug - 24-10-2007, 07:27 AM - Forum: 6.14 Control Flow - Replies (10)

The wording of 14.1 does not clarify the issue clear enough. I've discussed with several experienced persons and the common of these discussions is, that the questions only can be resolved, if someone ADDS personal interpretations. That cannot be the intension of a rule (text).

Firstly, \"defensive programming\" is not a misra rule. In my opinion this is a severe lack in/on the misra rule set. Although not explicitly defined its used in the rule text of 14.1 and its used in a confusing way: \"Code that can be reached but may never be executed is excluded from the rule (e.g. defensive programming)\".

In my tries to understand this, I refactored this sentence on following part (and nobody out of my discussions with Developers and QA Managers could give me an answer on that):

What is \"code, that can be reached but (may) never be executed\" ?

The provided example does not answer this question, because it shows code that \"exists but never will be reached\".

Maybe it helps to concretesize my intention when I re-word above sentence as follows: \"Is it possible, that code can be reached but not executed ?\"

Thanks in advance

Frank

Print this item

  Macros & 14.3 II
Posted by: gs - 22-10-2007, 02:51 PM - Forum: 6.14 Control Flow - Replies (1)

Since, according to http://www.misra-c2.com/forum/viewtopic.php?t=264, the following code is not permitted:

Code:
#if debugging
#define ASSERT(x)    asserttest(x)
#else
#define ASSERT(x)
#endif

void f(int *p)
    {
    ASSERT(p != 0);
    }

How would one make code well formed with respect to assertion macros?

Print this item

  Rule 19.9
Posted by: frankdelamarre - 08-10-2007, 12:38 PM - Forum: 6.19 Preprocessing Directives - Replies (1)

Can you please supply an example of a violation of rule 19.9? This would help to understand what the rule is really trying to enforce.

Print this item

  MISRA C:2004 rule 19.4 / extension
Posted by: Laessle - 26-09-2007, 05:59 AM - Forum: 6.19 Preprocessing Directives - Replies (1)

In our code we want to use generic macros of kind

#define macro(a) int array[2] = {a, a};

unfortunately a do-while-zero loop does not helps, cause defined objects are only known within the loop.

So we would like to ask for a further exception of the described kind.

In the attachment you will find an example to demostrate the intention of such macros.
The program reads values of an Analog Digital Converter (via SPI) and writes modified values to a Pulswidth Generator (also via SPI).
All transfers are coded in an array (Transfer_List). The contents of the array depends on the hardware (baudrate, data-format) and the tranfer-typ (read, write
number of values). The C-file has no hardware dependant function. All hardware specific settings are encapsulated in the macro Create_Transfer_List.
Modifying the hardware only needs to modify the macro. Further I/Os can be implemented very easily.

We would appreciate your positve response.

Mit freundlichen Grüßen/Best regards,

Hans-Peter Lässle
Control Systems
ETC-D

Continental Teves AG & Co. oHG
Guerickestr. 7, D-60488 Frankfurt am Main
P.O. Box 900120, D-60441 Frankfurt am Main

Telefon/Phone: 0049 69 7603-5418
Telefax: 0049 69 7603-3990
E-Mail: [email protected]
http://www.contautomotive.com
_____________________________________________________

Continental Teves AG & Co. oHG, Guerickestr. 7, D-60488 Frankfurt am Main
Sitz der Gesellschaft/Registered Office: Frankfurt am Main, Registergericht/Registered Court: Amtsgericht Frankfurt am Main HR A 27047, USt.-ID-Nr./VAT-ID-No. DE 112160365
Gesellschafter/Shareholders: Continental Aktiengesellschaft (geschäftsführend/managing)
Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board: Dr. Hubertus von Grünberg
Vorstand/Executive Board: Manfred Wennemer (Vorsitzender/Chairman), Dr. Alan Hippe, Gerhard Lerch, Dr. Karl-Thomas Neumann, Dr. Hans-Joachim Nikolin, Heinz-Gerhard Wente, William L. Kozyra (stv./Deputy)
Sitz der Gesellschaft/Registered Office: Hannover, Registergericht/Registered Court: Amtsgericht Hannover HR B 3527
Continental Teves UK Ltd., Company Number 00700225, Ebbw Vale, Wales, Großbritannien/Great Britain
_____________________________________________________
Proprietary and confidential. Distribution only by express authority of Continental AG or its subsidiaries.

Print this item

  Infinite loop
Posted by: JonM - 12-09-2007, 01:29 PM - Forum: 6.13 Control Statement Expressions - Replies (3)

What is the preferred implementation of an infinite loop?

Code:
for ( ; ; ) ...

or

Code:
while (1 == 1) ...

or

something else?

Thanks in advance.

Jonathan

Print this item

  why example suite not test suite
Posted by: MMouse - 27-07-2007, 08:14 AM - Forum: MISRA-C:2004 Exemplar Suite - No Replies

Why is it an example suite and not a test suite?

what can we use the example suite for?

Print this item

  New discussion topic - Exemplar Suite
Posted by: david ward - 26-07-2007, 02:52 PM - Forum: MISRA-C:2004 Exemplar Suite - Replies (3)

This topic is for questions and discussions related to the Exemplar Suite. For questions or discussions relating to the Rules which arise from using the Exemplar Suite, please post these in the appropriate Rule topic.

Print this item

  MISRA C TC1 and Exemplar Suite now available
Posted by: david ward - 20-07-2007, 01:44 PM - Forum: Announcements - No Replies

MISRA is pleased to announce the availability of the following resources for MISRA C:

  • Exemplar Suite
  • Technical Clarification 1 for MISRA-C:2004.
You can download the Exemplar Suite and TC from the "Resources" section of this Forum website which is visible when logged in as a registered user. Follow the link at the top of the page to register if you are not already a registered user.

July 2008: Note that a new edition of MISRA-C:2004 that incorporates the TC text is now available.

Print this item

  MISRA C:2004 Exemplar Suite
Posted by: david ward - 20-07-2007, 01:41 PM - Forum: MISRA C resources - No Replies

This suite of files is intended to illustrate issues addressed by the MISRA C rules as expressed in:

  1. MISRA-C:2004 Guidelines for the use of the C language in critical systems, ISBN 0 9524156 2 3 paperback and ISBN 0 9524156 4 X PDF.
  2. MISRA-C:2004 Technical Corrigendum 1
This Exemplar Suite is not exhaustive, but provides examples of key issues.

Please note that the Exemplar Suite is not a compliance or conformance test suite, since considerably more examples would also be needed in such a suite. Also MISRA does not offer compliance or conformance testing for tools or products.

Use of this Exemplar Suite is subject to the conditions in the enclose READ_ME file. In particular please note that a free license of these code examples is offered only for individual use. Redistribution of the code examples in any form is not permitted. If you wish to use the Exemplar Suite in this way, including distribution with a tool, please contact MISRA for licensing terms.

This suite will be updated from time to time. You can check you have the latest version by visiting this area of the MISRA Forum. There is an MD5 checksum provided in the file description that can be used to check that a copy of the archive is a genuine copy.  The date and version number of the latest release will always be listed at the end of this post.

Version history

Version number: 1.0
Date: 17 July 2007
Reason: Initial release

Latest release

Version number: 1.0
Date: 17 July 2007



Attached Files
.zip   MISRA-C_exemplar_suite_2007_07_17.zip (Size: 126.71 KB / Downloads: 18)
Print this item

  MISRA C:2004 Technical Corrigendum 1
Posted by: david ward - 20-07-2007, 01:31 PM - Forum: MISRA resources - No Replies

Since the publication of MISRA C:2004, the MISRA C Working Group have developed the Exemplar Suite (see separate topic). During the development of the Exemplar Suite, and based on questions raised on this Forum, a number of issues have been identified. This document provides clarification on these issues. The clarifications described by this document are incorporated into the Exemplar Suite release 1.0 dated 17 July 2007.

This document is intended to be used in conjunction with a copy of MISRA C:2004.

Please note: copies of MISRA C:2004 purchased on or after 21 July 2008 are a revised edition that incorporates these changes in the text.



Attached Files
.pdf   MISRA_C2_TC1.pdf (Size: 475.48 KB / Downloads: 35)
Print this item

Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,214
» Latest member: kdriedger
» Forum threads: 1,017
» Forum posts: 2,796

Full Statistics

Online Users
There are currently 136 online users.
» 0 Member(s) | 133 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: 189
A3-3-2 Contradictory exam...
Forum: AUTOSAR C++:2014 rules
Last Post: cgpzs
31-03-2025, 09:30 AM
» Replies: 2
» Views: 324
16.6.1 clarification
Forum: 4.16 Overloading
Last Post: cgpzs
31-03-2025, 09:29 AM
» Replies: 2
» Views: 310
Rule 9.3.1 - iteration st...
Forum: 4.9 Statements
Last Post: misra cpp
28-03-2025, 01:17 PM
» Replies: 1
» Views: 200
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: 222
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: 187
Adopted modal expressions...
Forum: General Questions
Last Post: Yordan Naydenov
17-03-2025, 09:01 AM
» Replies: 0
» Views: 297
Roadmap to c23 support
Forum: General Questions
Last Post: ACHart
28-02-2025, 03:23 PM
» Replies: 0
» Views: 224
Rule 6.2.1 weak linkage
Forum: 4.6 Basic concepts
Last Post: misra cpp
28-02-2025, 01:04 PM
» Replies: 1
» Views: 284
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: 729